Skip to content

Category: .NET Core

Static Analysis for .NET Core Projects using SonarQube

Static analysis is a way of automatically analysing code without executing it. As a development team, this is really powerful as once the static analysis software is up, running and integrated with your deployment pipelines you can gain an extra tester in your team with little ongoing maintenance! While some of the issues static analysis software finds are not always high value (code styling for example) some are issues your engineers are less likely to notice such as obscure security flaws and out of date dependencies. SonarQube; A Static Analysis Tool SonarQube is a static analysis tool that I have been using and…

Contract Testing with Pact in .NET Core

When working in a microservice architecture it can be hard to verify the whole system end to end due to all the moving parts involved. Often the purported solution to this is to write integration tests which verify a couple bits of the system at the same time with the test mocked out. If all these subsections of the system pass their respective integration tests we can be confident in the system, right? The Problem with Integration Tests Integration tests are a good way of verifying our system as they use real (not mocked out) components but quite a lot…

Selenium Solved: Null Responses for HTTP Session Requests

Recently I was updating the UI tests in a project now Selenium Webdriver plays nice with .NET Core. And came across a strange error: View the code on Gist. What made this a strange error is it is a failure to communicate with the Webdriver Server, not my underlying application and because of this failure in communication Webdriver could not manipulate my website. The Fix After some googling, this turns out to be a straightforward fix – my project uses the Chromedriver server as it’s Webdriver for tests and simply the Chromedriver server executable I had locally was out of date when…

Upgrading From IdentityServer 3 to IdentityServer 4

Upgrading from IdentityServer 3 to 4 isn’t too tricky but there are some traps you can fall into if you are not careful. Type Changes Scopes are now API Resources Scopes in IdentityServer 3 were used to define a resource and the secret required to get access to that resource. Now, this class has been updated to an API Resource as an example of how the new object might look like: View the code on Gist. As you can see above the Scopes are now handled as a property of an API Resource. Clients now request an API Resource and…

ASP.NET Core 2 Solved: Authorization was successful for user: (null).

While I was migrating an ASP.NET Core 1 project to version 2 my authentication code stopped working. After some investigation I kept running across this info message in my application logs which seemed unusual: View the code on Gist. The Fix Turns out this is a simple issue to fix. Just make sure that in the Configure() method in the Startup class contains a call to app.UseAuthentication() before the call to app.UseMvc() for example: View the code on Gist. With this method updated to include the Authentication middleware, the issue should be resolved.