WebSockets.

HttpContext.WebSockets.IsWebSocketRequest always null in .NET Core?

This article explains another simple fix to an annoying issue. I guess that’s how I start most 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. What gives? Problem…Continue reading HttpContext.WebSockets.IsWebSocketRequest always null in .NET Core?

WebSockets.

How to test a WebSocket connection directly in browser

This article documents a neat and simple way to establish and test a WebSocket connection, using just vanilla JavaScript and your favorite browser’s developer tools. Quick and easy – no external tools or libraries required! This is neat because you don’t want to have your information (credentials, hostnames, or even test data) leaking to outsiders hosting the tools – and using any external tools can be a bit of a drag anyway! In the sample found in a few paragraphs below, we’ll instantiate a WebSocket…Continue reading How to test a WebSocket connection directly in browser

Powershell is hell

Solving “Unable to find repository ‘https://www.powershellgallery.com/api/v2’.”

So, you’re running a PowerShell command that requires a connection to PowerShell gallery, but you run into an error message, somewhat like this: “Unable to find repository ‘https://www.powershellgallery.com/api/v2’. This can happen when you’re running something like Install-Module or Update-Module. This pretty much blocks you from doing anything that would require the use of new modules – so, quite a lot. Worth fixing, then. 😁 Problem The whole error message might be somewhat like this: What gives? Posts Related to “Solving “Unable to find repository ‘https://www.powershellgallery.com/api/v2’.””:How…Continue reading Solving “Unable to find repository ‘https://www.powershellgallery.com/api/v2’.”

Better blame TLS 1.0 for this one.

How to force an outdated .NET project to use TLS 1.2?

This article explains a kind of weird fix to a pretty annoying issue with a legacy service. And I’m not just calling it legacy because it’s WCF – I’m calling it legacy because it’s old. The particular piece of software was developed about 7 years ago (2014-ish)! It had worked for quite a while – but now it was down. I know, I know – 2014 is not THAT old. There’s surely COBOL that’s been running since the 70s, if not before. But in the…Continue reading How to force an outdated .NET project to use TLS 1.2?

While only a few countries use absurd date formats (such as the Month-first approach adopted by some former European colonies), there's no shortage of different date formats out there. Source: John Harding/Mona Chalabi

Experiment: DateTime formats

This article explains how to loop through all supported cultures on any given machine that’s able to run .NET. The code sample is in C# and outputs an HTML table you can copy – but obviously you can adapt it to your needs! This was something I needed to support some weird documentation task way back when – and it took me like a year to finish this blog post and push it out from the drafts… Background Okay. So I needed to figure out…Continue reading Experiment: DateTime formats

Visual Studio logo

How to fix a build configuration that’s not available as a build directive in Visual Studio?

This article describes how to fix and tweak your pre-build directives in Visual Studio – just in case they refuse to work properly. Because yeah, apparently that sometimes just randomly happens. But fear not – there’s a stupid and ugly, but definitely thoughtful workaround available! Also, sorry for the confusing title. I’m taking suggestions for a more descriptive one – but this one was kind of difficult to word clearly. Anyway – on to the topic of the day! Problem So you’re either trying to…Continue reading How to fix a build configuration that’s not available as a build directive in Visual Studio?

Entity Framework Core logo

How to fix “No database provider has been configured for this DbContext” in EF Core?

I’m using Entity Framework in most of the projects that I’m working on – and for the most part, it’s a pleasure to work with. But as always, there are plenty of chances to run into issues… So obviously, I stumbled into all of the rare stuff that IS broken! This one I hadn’t really seen before: “No database provider has been configured for this DbContext”. This time I encountered the issue while setting up a new project and getting started working on the model.…Continue reading How to fix “No database provider has been configured for this DbContext” in EF Core?

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

“Missing value for AzureWebJobsStorage in local.settings.json” when debugging Azure Functions locally?

Another day, another issue with Azure Functions! For such a simple and powerful tool, it sure does produce a lot of topics for blog articles! 😁 So, in this article, I’m explaining a couple of possible reason why you might get an error along the lines of “Missing value for AzureWebJobsStorage” when debugging Azure Functions locally. But before jumping into the solution(s), let’s take a closer look at the issue at hand, shall we? Problem When firing up your Azure Functions project locally, this error…Continue reading “Missing value for AzureWebJobsStorage in local.settings.json” when debugging Azure Functions locally?

An accurate depiction of a NuGet package factory

Azure DevOps Pipelines Caching

Azure DevOps pipelines have a pretty handy feature called Pipeline Caching. It’ll help you avoid annoyingly long NuGet package restores in your builds. And that makes sense – why would you restore packages again and again and again, if you’re not updating your dependencies meanwhile? And especially in the case of CI or CD pipeline, you’ll end up having a pipeline running constantly without packages actually getting bumped up – so your NuGet task is downloading the same packages over and over again. That’s where…Continue reading Azure DevOps Pipelines Caching

When my Azure Function doesn't build

How to fix “System.IO.FileSystem: Could not find a part of the path \AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers. Value cannot be null. (Parameter ‘provider’)” when running Azure Functions locally?

Well, that title is a mouthful. But it’s the topic for today, so what can you do? That said, this article should be pretty topical, as the issue started popping up only a few days ago. Chances are it’ll be patched soon enough, but in the meantime, it’s always useful to document the fix! Problem When running or debugging Azure Functions locally, your runtime just blurts our this error and fails to compile your functions: [2021-01-11T10:28:11.495Z] A host error has occurred during startup operation ‘0d00defa-b8bd-4fb8-9794-b0e5950a4c38’.…Continue reading How to fix “System.IO.FileSystem: Could not find a part of the path \AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers. Value cannot be null. (Parameter ‘provider’)” when running Azure Functions locally?

Have you tried turning it off and on again?

How to nuke the Identity Cache in Visual Studio?

This article explains one easy workaround to a lot of Visual Studio authentication issues. Personally, it’s helped me multiple times when Cloud Explorer has gotten into a weird authentication loop or Visual Studio stops seeing my MSDN subscription. And it also helps you clean up any old and unused credentials – such as the ones you only used once in 2018 to log into a customer’s Azure environment to debug an issue they had with their AppInsights extension on an app service (and that ended…Continue reading How to nuke the Identity Cache in Visual Studio?

What in tarnation (and tarnation accessories)

Fixing unexpected Microsoft.AspNetCore package errors after a dependency update

This was a fun one! Suddenly, while running or debugging my ASP.NET Core 3.1 application, I started getting errors about missing assemblies, along the lines of “FileNotFoundException: Could not load file or assembly Microsoft.AspNetCore.Components.Forms”. These DLL files were not required a minute earlier – nor did requiring them really make much sense in my mind – but there was a nonsensical, easy fix, so in the end, it was all good! But let’s go through this thing in order. What was the problem? Problem So,…Continue reading Fixing unexpected Microsoft.AspNetCore package errors after a dependency update

Microsoft Graph g-raph (giraffe) - the spirit animal of Microsoft Graph

Graph API throws “$count is not currently supported.” when you KNOW it’s supported?

Hey, another funny case. “Funny” as in “the error message is misleading and googling didn’t really help”, but also as in “a colleague knew the answer right off the bat because he already fixed it in another project”. This time the documentation was in fact there, it just wasn’t there to be found. Anyway – what have I broken this time? Problem When you’re calling Graph API with both $filter and $count, for example: Instead of the expected number of found items, you get results…Continue reading Graph API throws “$count is not currently supported.” when you KNOW it’s supported?

Entity Framework Core logo

“An assembly specified in the application dependencies manifest was not found” when running Add-Migration in Entity Framework Core?

Another quick one – I’m sure this doesn’t apply to all cases, but I’m still logging it in case someone (like myself) stumbles upon the issue and finds help here. I was building a solution with some Azure Functions fetching and populating data in a database, and was planning on building a UI for browsing the data at some point later on – but I actually got stuck on the second step already :) While adding the database to my project, and running Add-Migration in…Continue reading “An assembly specified in the application dependencies manifest was not found” when running Add-Migration in Entity Framework Core?

Pulumi Azure Next-gen logo/splash

Pulumi task on Azure DevOps fails with error “azureblob.OpenBucket: accountName is required”

This article explains how to fix one of the many issues you might face when configuring Pulumi deployments for your Azure DevOps Pipelines! The particular error you may run into was “azureblob.OpenBucket: accountName is required” – what a descriptive one, when there’s no accountName to be specified anywhere! But first – let’s get through the basics. Namely… “Pulumi?”, you ask – “What’s that?” Well, let me give you a 1-line response to that. One very long line, that is. But what was the error I…Continue reading Pulumi task on Azure DevOps fails with error “azureblob.OpenBucket: accountName is required”

Say "Dependency Injection" one more time I DARE YOU

How to inject EF Core DbContext in an Azure Function

Ah, one more on the related topics of different configurations for your Azure Function apps. In this article, I will describe how you can configure the Entity Framework Core database context to be injected into your Azure Functions App. In my experience, this is a very typical and often-needed model to structure your Azure Functions. Therefore, while tooling and templates aren’t quite there, it’s worthwhile to document how to do this somewhere – well, here. Solution I’ve posted before about how to instantiate a database…Continue reading How to inject EF Core DbContext in an Azure Function

Entity Framework - am I right?

“Conversion overflow” when reading numeric data from MS SQL database using Entity Framework

This article explains how to fix a weird situation where your .NET application utilizing Entity Framework or Entity Framework Core simply crashes without any way to recover or catch the Exception. You only get errors somewhere along the lines of “conversion overflow”. Ah – what a fun little issue! Problem So when you’re trying to instantiate an entity with a property of type decimal, you’ll get one of the 2 following exceptions with varying Call Stacks: Conversion overflow or: Arithmetic overflow error converting numeric to data type numeric…Continue reading “Conversion overflow” when reading numeric data from MS SQL database using Entity Framework

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

How to configure Azure Function’s startup

Azure Functions use dependency injection, and that allows us to define all kinds of prebuilt or custom-built services as being available for our functions really easily. This is a really easy way to initialize scoped resources to be used in your different functions… But how do you actually configure them in an Azure Functions App? Problem Okay, a step back – there’s a bit of a problem that we need to resolve before we can proceed with the configuration. When you create a new Azure…Continue reading How to configure Azure Function’s startup

git logo

How to list your git stashes

Long story short, yes, I really had to google this, and since top results seemed to give pretty unclear (or even wrong) answers, I decided to document it for myself. Maybe it’ll be helpful to someone else too! And just to state the obvious: I’m using GitHub Desktop for most of my mandatory Git stuff, but whenever I have to run any git commands, I run Windows PowerShell (git exe is added to PATH variable). Solution Well, it’s actually very, VERY simple. You can just…Continue reading How to list your git stashes

SharePoint is not broken - it just does't work

(Literally) Breaking: Changes to app authentication on SharePoint! 😵

This article explains how to get rid of sudden and unexplainable 401 Access Denied errors when trying to authenticate against a fairly fresh Microsoft 365 / SharePoint Online tenant. This issue seems to be caused by a long-ish project to finally retire ACS – Azure Access Control service) on SharePoint (it’s retired everywhere else already!) Note: This is an updating story, as the situation with ACS is definitely… Developing. Yeah, let’s call it that. It’s a developing situation. Problem In the beginning of September (2020),…Continue reading (Literally) Breaking: Changes to app authentication on SharePoint! 😵