Fix slow NCrunch build
NCrunch is a great unit test runner and has been part of my developer toolbox for many years. Recently I was having an issue on a medium-sized project where the NCrunch’s Build step was taking almost 2...
View ArticleShow Swagger documentation on Azure Service Fabric
Another blog post in what seems to be becoming a series of posts on Swagger. Swashbuckle allows you to include XML comments on your API’s Swagger page. To do this you need to set your Build to output...
View ArticleDisplay Authorization properties in Swagger
Another handy extension to Swashbuckle which I have written displays which endpoints have Authorization, and which policies, roles, or users have access to that endpoint. You can get it by installing...
View ArticleAdd an authorization header to your swagger-ui with Swashbuckle (revisited)
Just over a year ago I blogged a simple way to add an authorization header to your swagger-ui with Swashbuckle. Although that works, Swagger-UI and Swashbuckle support a better way, which I’ll describe...
View ArticleWhere to download vstest.console.exe
Often when I’m debugging builds or releases on VSTS, I will see that it uses the vstest.console.exe command line for running tests. Sometimes I need to run vstest.console.exe locally so that I can...
View ArticleAzure Key Vault + MSI = failing Web API integration tests
Introduction In a number of our ASP.NET Core Web APIs we’re using Azure Key Vault for keeping secrets such as connection strings and authentication credentials out of source control. Initially we were...
View ArticleVerify data in tests with ASP.NET Core and EF Core in memory
Introduction You’re writing a Web API with ASP.NET Core 2.1, and use EF Core as your ORM. If you follow the official guidance on doing integration tests in ASP.NET Core 2.1, then you can use either an...
View ArticleAdd Swagger request and response examples in XML
A few years ago I blogged about how to add Swagger examples for requests and responses. But those examples are rendered in JSON. What if your application supports XML, wouldn’t it be nice to see the...
View ArticleSwagger or OpenApi 3.0 examples in Swashbuckle.AspNetCore
If you’d like to generate request and response examples for your APIs, you no longer need to use my Swashbuckle.AspNetCore.Filters package. Since May 2018, Swashbuckle.AspNetCore supports adding...
View ArticleConditionally specify a property in an ARM template
At my current contract I’ve been doing a lot more DevOps than I have in the past, mainly because they don’t have enough specialist DevOps engineers. So us developers are encouraged to look after our...
View ArticleTestServer cannot resolve scoped service
I’m using ASP.NET Core’s WebApplicationFactory<T> to run outside-in BDD-style acceptance tests. One of my tests needed to resolve a scoped service, and I was suprised to find it crashed with an...
View ArticleReturn objects instead of enums in RESTful APIs
A question that came up at work recently was, “should we return enums as ints or strings”? The client-side team shouted that they prefer strings please, rather than “magic” ints. I’m not a fan of...
View ArticleDecompile ASP.NET source from deployed dlls
We had an interesting scenario at a client’s a couple of months ago. A staff member had deleted the source code repository for an ASP.NET Web API from Azure DevOps – their justification was that the...
View ArticleWindows Authentication with a .NET 6 typed HttpClient
Recently at a client’s site I had to write a new API which calls a downstream web API which was secured with Kerberos authentication, or something, I think. Not sure. I dug up the code for an existing...
View ArticleStub typed HttpClients in ASP.NET 6 integration tests
For the last 8 years or so my work doesn’t have many unit tests in it, instead I favour integration tests which fire up and run the web API we are testing in memory, and then run tests against that....
View ArticleASP.NET 6 return a message in a ProblemDetails with a 404s and 400s
In ASP.NET 6, the standard way to return a 404 from a Controller action is with return NotFound(); And if you want to return a message with it, you can do return NotFound($"Couldn't find an account...
View ArticleFun with a Raspberry Pi Zero 2
A few years ago I setup Pi-Hole on a Raspberry Pi 3B+. Recently we went away on holiday for a month, and I powered it down before we left. When we came back and I switched everything back on, it worked...
View ArticleDeploy .NET 8 Blazor app to Azure Static Web App
At work I was asked to create and deploy a new .NET 8 Blazor app to an Azure Static Web App. I’m brand new to Blazor, and brand new to Azure Static Web Apps, so I had a few stumbling blocks. One of...
View ArticleBicep warning – BCP081: Resource type does not have types available
If you see the above BCP081 warning, it means you’re trying to use something like this, which is copied and pasted from Microsoft’s own reference page: resource symbolicname...
View ArticleOperation references schema that does not exist.
I was getting the above error while trying to deploy Bicep templates for an Azure API Management API. Specifically, I was trying to use the validate-content policy to validate the JSON schema of the...
View Article