Azure Functions CLI - such a pretty logo for such an awesome functionality

Ignite 2018 recap: What’s new for Azure Functions?

Reading Time: 4 minutes. Ignite 2018 is done and dusted, and it’s a good time to quickly recap what’s new for Azure Functions in the coming months. They’ve certainly been getting a lot of love from Microsoft, which is GREAT! New features for Azure Functions There was a bunch of exciting new things announced! Not all of the things in this blog post are necessarily completely new – but rather reached General Availability. Let’s go through them one by one… Posts Related to “Ignite 2018 recap: What’s new for Azure Functions?”:SharePoint-Teams -integration using a tabGetting Connect-MsolService (and other Azure Active Directory PowerShell cmdlets) to […]

"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." leads to a 404 error in jQuery.

How to fix an Azure Function (v2) failing with error “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.”

Reading Time: 4 minutes. This post was most recently updated on November 1st, 2018.This post describes one way to resolve a problem, where you receive an error like “The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.” when calling your Azure Functions. Update: The issue described in this post has now been fixed, so if you’re using the GA version of Azure Functions CLI, this post shouldn’t interest you anymore! Problem Another day, another simple, yet kind of weird issue to solve! This time I was developing a simple Azure Function to access Microsoft Graph API. This […]

How to show any page in a pop-up in SharePoint

Reading Time: 6 minutes. This post was most recently updated on December 9th, 2018.This ages old trick deserves to be published – since it makes it easy to quickly show info from pretty much any another page on pretty much any classic SharePoint page (in a SharePoint-compatible pop-up). So, here goes: Using SharePoint’s JavaScript library to open an arbitrary pop-up Yes – SharePoint contains all the functionality out-of-the-box, and you almost don’t have to do anything yourself! Let’s see how this works. Okay – long story short. On all Classic SharePoint pages, you can call this function: SP.UI.ModalDialog.ShowPopupDialog(). Like it says, it quite simply just […]

How to SharePoint?

Using “DetectedLanguage” to return only localized results from SharePoint Search index

Reading Time: 5 minutes. Localization and targeting of content in multilingual SharePoint installations is always an issue. SharePoint offers a multitude of ways profile content based on user language (or other properties), but none of the solutions are fool proof. This post describes how to fetch only localized results from SharePoint Search index, which solves at least some of the issues. Description  SharePoint Search index can be used in quite a few different ways. Probably the most typical way is by searching on SharePoint, or using webparts like Content Search or Content Results. However, one can also build custom functionality, custom client-side liftups, webjobs, […]

Call to sites Graph API requires “owner” permissions for site collection regardless of app permissions

Reading Time: 4 minutes. This post was most recently updated on March 20th, 2018.Okay – yet another weird issue, and a hacky workaround. I was developing an app that was calling a SharePoint site through Graph API, using jQuery $.ajax call (developed in TypeScript), and ran into surprising 401 errors. I did find a workaround, but am also working on an actual fix. Description To get SharePoint site ID, which is needed when accessing SharePoint lists, the calls seemed to fail for my test accounts. Everything was working fine for my developer account, which was a global admin, so the first thing I was […]

Mock Function call to force loading an assembly - how elegant!

A quick (and handy!) hack to force referenced assembly to getting copied to a project

Reading Time: 3 minutes. This post was most recently updated on December 17th, 2017.Visual Studio failing to copy a referenced assembly to a project in build might lead to surprising runtime errors. This post will explain one method of fixing these issues, using Microsoft.IdentityModel.Clients.ActiveDirectory as the example – as earlier versions of that assembly had this issue! Problem After build, you might get this kind of error: Could not load file or assembly ‘Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.13.1.846, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, […]

Microsoft Teams Logo

SharePoint-Teams -integration using a tab

Reading Time: 8 minutes. This post was most recently updated on October 9th, 2018.This post describes one possible scenario for SharePoint-Teams -integration, how to achieve that, and what kind of issues there might be. Teams? What’s that? At Blue Meteorite, we at the Valo team have been leveraging Teams since early 2017 as our main communications channel. For us, it complements Yammer, email and Skype for Business quite nicely, although to be fair, it’s not always 100% clear which channel would be optimal for a certain piece of communication… 🙂 The Redmond Magazine calls Teams Microsoft’s response to Slack, and for someone who has […]

Visual Studio logo

Fixing the “Could not load file or assembly … or one of its dependencies” error

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.This post describes how to fix the “Could not load file or assembly ‘<assemblyname>’ or one of its dependencies. An attempt was made to load a program with an incorrect format.” error.  Problem Especially while installing a new dev machine, and building your project for the first time, you may end up getting the following exception: Could not load file or assembly ‘<assemblyname>’ or one of its dependencies. An attempt was made to load a program with an incorrect format. No fear, though, as this is usually easily fixed. In quite […]

EIG is basically a host of scams now.

One web developer’s story about the downfall of web hosting (EIG/Site5 review) – part 1

Reading Time: 7 minutes. This post was most recently updated on August 25th, 2018.Okay, so this is going to be a bloggish rant about EIG – Endurance International – a web “hosting” company that’s ruining the web for everyone. If you hate salty rants, browse something else, please! I’ve been an independent web developer since around 2004, and even though maintaining and hosting websites is currently more of a hobby than anything else, I still do have a few dozen customers with one or more websites or other systems hosted by me. For more than 10 years I’ve been hosting both my and my […]

Sequence contains more than one element

Launching a new debugger instance from code in Visual Studio

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.This post describes a quick solution to launching a new Visual Studio instance for debugging the code. Where I’ve found this exceptionally useful, has been in debugging code-first migration’s (one of the ways for database initialiation in .NET) Seed-method. It is by default undebuggable, as when you are running Update-Database you can’t really use a -debug switch or anything, and there’s really no way to launch the debugger. Hence the best you can do is using -verbose to get more information. However, if you actually want to see what is happening […]

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

Fixing error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient'”

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.This post describes the fix to error “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’”, which Visual Studio throws at your face when you try to run an application on any Windows-based system (or which you’ve dug out of event logs). Also, you’re probably using Entity Framework in your project. Error When debugging/running your code you get an error like this: An exception of type ‘System.InvalidOperationException’ occurred in EntityFramework.dll but was not handled in user code Additional information: No Entity Framework provider found for the ADO.NET provider […]

System.InvalidOperationException'

Using Dispatcher to update values in GUI elements from a background thread

Reading Time: 3 minutes. This post was most recently updated on October 9th, 2018.Quick tip: If you’re developing something like a WPF app and you’ll need to update values on the User Interface based on a long-running operation that runs in a background thread (like depicted in my other blog post right here – that post is for a full-trust SharePoint solution, but the basic principle is the same!), you’ll probably need to use Dispatcher, or otherwise you’ll run into issues with the GUI elements being owned by another thread, and therefore forbidding access to them. This can result in an error like this: An […]

Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

Reading Time: 3 minutes. This post was most recently updated on October 9th, 2018.This post describes how to run Entity Framework’s code-first migrations against a database located in the Windows Azure. This is done by running Update-Database commandlet with suitable switches, see below. The problem and symptoms Okay, so you’re developing your MVC+EF cool web app with a database in Azure, and you’re using code-first migrations. Cool! What’s nice with code-first-migrations is the fact they are run automatically even in the cloud the next time your app is running (as long as you publish your app with that little box ticked – something like […]

SharePoint_aint_broken

Updating files in an App Part (SharePoint Add-in)

Reading Time: 3 minutes. This post was most recently updated on October 9th, 2018.Luckily, SharePoint Add-ins (or App Parts, like they were called earlier) are slowly getting killed and rooted out of all the sites they once were deployed to – and I don’t think anyone’s going to miss them. However, as so often happens with legacy implementations, there will still be thousands of sites, where SharePoint administrators and developers will be responsible for maintaining and developing the solutions further. This will occasionally require updating app parts, which is a process that kind of sucks. Here I’ll try to simplify the process. Problem(s) Not all the […]

IIS8

Exception of type ‘System.OutOfMemoryException’ was thrown.

Reading Time: 3 minutes. This post was most recently updated on October 28th, 2018.This post describes one of the more no-brainerish ways of fixing a ‘System.OutOfMemoryException’ exceptions being thrown in your ASP.Net MVC application using C# and Entity Framework. Problem While developing a web project, for example ASP.NET MVC with EF, sometimes when handling a lot of data or complex entities on your dev machine, you encounter this error: OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.] System.Text.StringBuilder.ToString() +35 System.IO.StreamReader.ReadToEnd() +123 System.Web.Optimization.BundleFile.ApplyTransforms() +74 System.Web.Optimization.DefaultBundleBuilder.BuildBundleContent(Bundle bundle, BundleContext context, IEnumerable`1 files) +472 System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context) +127 System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context) +45 System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath) +166 System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable`1 assets) +205 System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] […]

Visual Studio settings for "Track my active file in Solution Explorer" - a really useful setting to have enabled, if you ask me!

Tip: Scroll Solution Explorer to current file in Visual Studio 2012, 2013, 2015 and 2017

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.This quick post describes how to get the Solution Explorer to actually track your currently open file. For some reason, this extremely useful feature is disabled by default in Visual Studio. Enabling it helps you to better conserve your context, and see which part of your solution you’re in, while you’re developing a complex piece of software. Give it a try, in case you haven’t already! It’s great and extremely useful! 🙂 Posts Related to “Tip: Scroll Solution Explorer to current file in Visual Studio 2012, 2013, 2015 and 2017”:Getting Connect-MsolService […]

Spatial SQL types

Solving the “Spatial types and functions are not available …” -problem

Reading Time: 3 minutes. This post was most recently updated on October 9th, 2018.This page describes mutiple ways on how to fix the exception ‘Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version 10 or higher could not be found.‘ which comes up during debugging or publishing your program, app or service using DbGeography. Symptoms While running a console program or perhaps installing an ASP.NET MVC website on a machine, where SQL Server (apart from the one that comes with the Visual Studio) has not been installed, you may encounter the following error: Spatial types and functions are not […]

entity-framework-logo

Fixing the error: “Column XX in table dbo.YY is of a type that is invalid for use as a key column in an index.”

Reading Time: 2 minutes. This post was most recently updated on October 9th, 2018.While using Entity Framework and code-first migrations, Entity Framework (EF) creates the indexes for you – but what if you need to create a custom one, explicitly based on certain field / column? Then you’ll have to tell EF which one to use as a key column. Usually, it’s easy – you just add the following annotation to the columns you’ll be using: [Index(“OfficialIds”, 1)] public int AreaId { get; set; } [Index(“OfficialIds”, 2)] public string EstateId { get; set; } (example stripped of extra code and other columns for clarity) And after adding the migration (Add-Migration… commandlet) you get something like this: CreateIndex(“dbo.Areas”, new[] { “AreaId”, “EstateId” }, name: “OfficialIds”); Okay, nice. […]

Update-Database error

Fixing “An error occurred while updating the entries” while running code-first migrations in MVC 5 app

Reading Time: 6 minutes. This post was most recently updated on October 9th, 2018.This post describes an issue with EF’s code-first migrations, when mapping between DB’s DateTime and C#’s DateTime kind of fails, and results in Update-Database cmdlet failing. It’s more or less a prime example of a situation, where the error itself tells very little about the actual issue, and since debugging code-first migrations is kind of difficult (see the best tips for that here!), it’s cumbersome to investigate. Symptoms "An exception of type ‘System.Data.Entity.Infrastructure.DbUpdateException’ occurred in EntityFramework.dll but was not handled in user code." I’ve encountered this error in 2 different situations. […]