Another fun one with Azure Functions! At least it’s a simple one: this time, I ran into a weird issue while doing some code reusing – well, copy-pasting – between a couple of different projects. I was lovingly hand-crafting some Azure Functions, while suddenly the Azure Functions host would throw me this in ugly, red letters: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: ‘Microsoft.AspNetCore.Mvc.Core, Version=18.104.22.168, Culture=neutral, PublicKeyToken=adb9793829ddae60’ at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters) at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name) at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name) at Mono.Cecil.MetadataResolver.Resolve(TypeReference type) at Mono.Cecil.ModuleDefinition.Resolve(TypeReference type) at Mono.Cecil.TypeReference.Resolve() at…Continue reading Azure Function build fails with “Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: Microsoft.AspNetCore.Mvc.Core”
So, a while ago I posted about a fairly simple way to write your code for fetching secrets (and other confidential stuff) from Azure Key Vault in such a way, that it would work the same way both in Azure and on your local dev box. I find this pretty important, as it reduces the need for weird workarounds and fallbacks in your code, and at the same time enables you to harness the Azure Key Vault for that sweet spot of “good enough security…Continue reading How to update from deprecated Microsoft.Azure.Services.AppAuthentication to new and shiny Azure.Security.KeyVaults.Secrets?
Let’s make this short and sweet. In this particular case, upgrading a Blazor WASM solution to .NET 6 broke the authentication when deployed to Azure. The same issue could probably happen to a fresh project, though. This is what you’re running into: If you open your browser console, you’ll see 2 interesting errors – first: dotnet.6.0.0.o2we6pverp.js:1 mono_wasm_runtime_ready login.microsoftonline.com/common/oauth2/v2.0/token:1 Failed to load resource: the server responded with a status of 400 (Bad Request) And a moment later, an error along the lines of: blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer…Continue reading Fixing Blazor WebAssembly .NET 6 MSAL authorization bug
Ah – this was a fun one. I needed to figure out how to purge, flush and clear your commit history on GitHub. Turns out it isn’t as easy as clicking a button in the web user interface – the world is apparently not ready yet! 😁 Luckily, it wasn’t that complicated either – and the steps should work for other flavors of git as well. Background Always remember to .gitignore your secrets, folks! And if you forget, pray you’re not committing to a public…Continue reading How to nuke your Git(Hub) commit history?
This article explains how to fix an issue where your Azure Functions function (yes, that’s a capital F and a lowercase f to denote the difference between the product and the piece of compute) fails to fire when a POST request comes in, even though it’s configured to do so, and instead throws a somewhat confusing error message about HttpRequestMessage not being castable to HttpRequest – even though you KNOW HttpRequestMessage works just fine for receiving POST requests with payload! So, why is this happening…Continue reading How to fix “Unable to cast object of type ‘System.Net.Http.HttpRequestMessage’ to type ‘Microsoft.AspNetCore.Http.HttpRequest’.”
Azure Key Vault is great. But when developing locally, it can be a bit of a pain. You can always circumvent it and create some classical solution, like wrapping all of your key/secret assignments in if-else-clauses that will use local configuration if you’re running locally and only call the Azure Key Vault if you’re in the cloud… But that feels so incredibly early-2000-ish. Isn’t there a better option available? I mean – obviously, there is! And we’ll see how it works in just a while…Continue reading How to authenticate against Azure Key Vault both in Azure and local development environment?
This article explains how to fix an annoying issue with Microsoft’s SDK for CosmosDb v3 – it comes with a Newtonsoft.Json dependency, that most of Microsoft’s recent packages have let go of. With .NET Core 3.1 having shipped with System.Text.Json included, and (mostly) replacing Newtonsoft.Json, it’s kind of the preferred option. However, CosmosDb v3 SDK doesn’t support it and by default requires you to use Newtonsoft.Json to override the property names, if you want to – for example – map entities with PascalCase naming with…Continue reading System.Text.Json.JsonPropertyName not working for CosmosDb in .NET Core/5?
Man, do I run into all kinds of issues with the smallest Azure Functions that I develop. And it’s mostly my fault. The silver lining is that you’re here to read this article, so you probably ran into this same stuff. Well – you should be happy to hear this article describes fixes to a couple of issues – let’s see if they help you out as well! The article probably largely applies to any situation where you have a project referencing another project and…Continue reading Errors loading an assembly that’s using Microsoft Graph API
This article explains another fun issue you might run into, when developing Azure Functions in your local environment. It was weird how unclear the few results I could find were, and the issue is just… Very hazy in general. But I was able to track the issue down, and thought I’d document the solution :) It’s for myself, really, because I’m pretty sure I’ll run into this one again. But if you find it useful, good for you! 😉 Problem So what is it, that’s…Continue reading ILogger binding suddely failing for Azure Functions – what to do?
Another day, another issue. This time, I was absent-mindedly following the guidance for a project on how to generate .sql files for .NET EF Core code-first migrations. Don’t ask why that was required, but it was. My migration was simple. Adding an entity with just a few properties. And Entity Framework created my programmatic migration just fine. But when generating the SQL file, I got nothing but an empty file. No matter what was my startup project, working directory, context, target folder, or other variables…Continue reading “dotnet ef script” or “Script-Migration” producing empty .sql files?
Another day, another issue – this time with an on-premises environment with a ridiculously complicated architecture and an absolute ton of pipelines. There are plenty of ways to fix this particular issue (because there are plenty of reasons), and after ferocious googling (and very brief binging just to see if Microsoft had found something Google hadn’t), the trail ran cold and I felt like nobody had run into the same issue before. This is probably not true – just that the documentation wasn’t there. So,…Continue reading How to fix a 403.18 in a virtual application?
Another day, another thing I’m trying to do on GitHub (and at least partially failing), another blog post! This time, I was configuring a build and ran into trouble. This article describes one possible fix to an issue where an error along the lines of “The GITHUB_TOKEN environment variable was not set” is thrown. As a backstory: I have a long history with Azure DevOps, and have maintained a kind of a love-hate -relationship (that maybe gravitates slightly more on the rosy side of things)…Continue reading GitHub Action fails with “The GITHUB_TOKEN environment variable was not set”
Today, I’m documenting a simple way to download audio files from Vidyard. This approach only works for files that aren’t password-protected or behind authentication – I don’t think you can use it easily for nefarious stuff, but just in case you’re trying to commit some kind of IP theft (intellectual property), please don’t. And definitely do not ask for instructions in the comments -section :) Anyway – why did I take up this task myself? What did I want to achieve, in order to need……Continue reading How to download audio files from Vidyard
This article describes a simple fix to an issue (well… One issue or many possible issues), where git fails to pull anything from remote, throwing instead an error somewhat like this: fatal: no such branch: ‘master’ Bah. This stops you from pulling any new changes from remote, and likewise it’ll stop you from pushing your new stuff out there. Always something going wrong with git, right? But what exactly is the reason this time? Problem So there I was, just following a guide on docs.microsoft.com.…Continue reading Visual Studio Code fails when running “git pull” for a new project
So one day, I needed to quickly check if an identity field in a view in a Microsoft SQL Server was actually unique or not. I was running into weird issues with Entity Framework throwing an error somewhat like this: Store update, insert, or delete statement affected an unexpected number of rows (2) Or somewhat like this: Type: DbUpdateConcurrencyExceptionStore update, insert, or delete statement affected an unexpected number of rows ([row count]). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540…Continue reading How to form a parameterized SQL query to find duplicates in a table.
This article describes how to configure your .NET Core application to serialize objects in camelCase instead of PascalCase. I guess this is another quick note – something that should be simple, but I couldn’t remember how to do it from the top of my head, and the solution turned out to be a bit unintuitive. I guess that makes it worth documenting because I’ll run into this again for sure. Anyway – let’s take a closer look at the actual issue at hand, shall we?…Continue reading How to serialize to JSON in camelCase using .NET Core?
This article documents the quick and dirty fixes and patches I’ve found for Home Assistant. I’m trying to document all the things that are not complicated enough to warrant an actual blog post themselves somewhere, and this page is as good a place as any. Hopefully, these tips end up being helpful to someone else as well!
One day I suddenly realized my Home Assistant’s ClimaCell integration stopped working. That was weird – it had been running just fine for a while. I had signed up for a ClimaCell developer account at developer.tomorrow.io (or whatever the address was before rebranding from ClimaCell to Tomorrow.io – but this is the portal I used) on the 28th of July, perhaps in 2020, or perhaps 2019. And it worked brilliantly so far, but suddenly and without warning, just stopped working. The only thing the log…Continue reading No way to renew a ClimaCell API subscription – what to do
This article explains another simple fix to an annoying issue. I guess that’s how I start like every other one of my little tutorials, but hey, it’s true! I suppose I just have a knack for running into issues that come with poorly documented fixes or workarounds that are obvious but only in hindsight… Right? Anyway, this time my WebSocket requests were not being handled as such by my ASP.NET Controllers. “IsWebSocketRequest” was suggested by IntelliSense, but it would always be null in the code.…Continue reading HttpContext.WebSockets.IsWebSocketRequest always null in .NET Core?