Allowing Azure DevOps Release Pipelines Access to Remote Artifacts

A screenshot of the Azure DevOps project summary screen with the "Project settings" navigation item highlighted

If you’re using Azure DevOps for your continuous integration/continuous deployment (CI/CD) pipelines you may have stumbled across a pretty cool feature: you can create a build pipeline artifact in one project and import it into the release pipeline of another project! I use this to build a utility once and then import it into several other projects to avoid having to build it several times and trying to maintain settings in multiple places.

The issue is that the first time I tried using this approach, I received the following error:

2022-05-31T06:42:42.2517765Z ##[section]Starting: Download artifact - _Utility App - Utility App
2022-05-31T06:42:42.3632226Z ==============================================================================
2022-05-31T06:42:42.3632956Z Task         : Download build artifacts
2022-05-31T06:42:42.3633439Z Description  : Download files that were saved as artifacts of a completed build
2022-05-31T06:42:42.3633715Z Version      : 0.200.1
2022-05-31T06:42:42.3634068Z Author       : Microsoft Corporation
2022-05-31T06:42:42.3634549Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/download-build-artifacts
2022-05-31T06:42:42.3634953Z ==============================================================================
2022-05-31T06:42:49.0078464Z Error: in getBuild, so retrying => retries pending  : 4
2022-05-31T06:43:34.1171511Z Error: in getBuild, so retrying => retries pending  : 3
2022-05-31T06:45:49.4315894Z Error: in getBuild, so retrying => retries pending  : 2
2022-05-31T06:51:49.7774413Z Error: in getBuild, so retrying => retries pending  : 1
2022-05-31T06:57:49.9960407Z ##[error]Failed in getBuild with error: Error: VS800075: The project with id 'vstfs:///Classification/TeamProject/{GUID}' does not exist, or you do not have permission to access it.
2022-05-31T06:57:50.0533271Z ##[error]Error: VS800075: The project with id 'vstfs:///Classification/TeamProject/{GUID}' does not exist, or you do not have permission to access it.
2022-05-31T06:57:50.0572339Z ##[section]Finishing: Download artifact - _Utility App - Utility App

I couldn’t find a clear answer for how to fix it but managed to get there with some trial and error!

Continue reading “Allowing Azure DevOps Release Pipelines Access to Remote Artifacts”

Null Reference Exception in Blazor Router

A screenshot of a stack trace produced from a .NET application. The main messages are "An unhandled exception occurred while processing the request. NullReferenceException: Object reference not set to an instance of an object. Microsoft.AspNetCore.Components.Routing.Router.Refresh(bool isNavigationIntercepted)". A full stack trace is visible below.

If you’ve used Blazor for a while you may have run into the following (pretty unhelpful) error message where the page router is throwing a NullReferenceException:

A screenshot of a stack trace produced from a .NET application. The main messages are "An unhandled exception occurred while processing the request. NullReferenceException: Object reference not set to an instance of an object. Microsoft.AspNetCore.Components.Routing.Router.Refresh(bool isNavigationIntercepted)". A full stack trace is visible below.
But what am I trying to reference that is null?!

The worst part is that I always seem to run into this error after making a bunch of changes and then having no idea exactly what I did to break the build (yeah I know, I should probably run my code more while making changes).

I’ve managed to form a general idea of why the error is thrown and have found two concrete situations that reproducibly cause the issue, so I’ve finally written them down for when I inevitably run into this situation again!

Continue reading “Null Reference Exception in Blazor Router”

Applying Authorisation Rules to a Folder of Razor Components/Blazor Pages

A screenshot of a Blazor app designed to test/demonstrate different approaches to applying authorisation rules to razor components

There’s a lot of flexibility in how you can use authorisation rules in Razor components*, but a frustration of this approach is that it seems like you have to slap @attribute [Authorize(Policy = "PolicyName")] at the top or every page with no clear way of applying a given policy to a whole folder of .razor files. After much research and testing, I’ve found how to go about it!

Continue reading “Applying Authorisation Rules to a Folder of Razor Components/Blazor Pages”

UI Flashes after Migrating Blazor Projects To .NET 6

A table with the title of "Vegetables". There are three columns (Id, Product and Quantity) and 3 rows of example data.

The Problem

I’ve noticed an issue recently after upgrading a few Blazor projects from .NET 5 to .NET 6 where the UI flashes after every call to StateHasChanged. Something like this:

A table with the title of "Vegetables". There are three columns (Id, Product and Quantity) and 3 rows of example data. The Id field disappears and reappears once a second causing the table to visibily shift back and forth
Flash. Flash. Flash. Flash…

Yeah, that’s not annoying at all. Unfortunately it was happening in quite a few different places and was pretty darn noticeable, so it looked like I was going to have to dive in and figure out what exactly was causing this to go wrong (despite working perfectly in .NET 5)!

Continue reading “UI Flashes after Migrating Blazor Projects To .NET 6”

Future Decoded 2018

Matthew Champion standing behind the Microsoft logo at Future Decoded 2018

A couple of weeks ago, I was at the first conference I’ve ever attended: Microsoft’s Future Decoded. Hosted at ExCeL in London, it was a two day event that looked at where technology is heading and how, in some cases, the future is already here.

Topics

Although there were many different official tracks (with names such as “Empower Employees”, “Grow Culture” and “Transform Products”), the overarching theme of the conference seemed to be artificial intelligence (AI), ethics and accessibility. Curiously, although mixed reality was referenced a few times in the keynotes and talks, it didn’t seem to me like it was a major focus for the event which was odd considering the direction that Microsoft are travelling in with their work on the HoloLens (which, as a side note, I finally got to try in person!).

Matthew Champion wearing a HoloLens. He is reaching into the air with his index finger and thumb pinching in the air.
Continue reading “Future Decoded 2018”