The term Nullable Reference Types refers to a set of features introduced in C# 8.0 that help us to write cleaner, more robust code that is resistant to unintended null dereferencing. The features that are provided make us aware of possible null reference exceptions that could occur in our applications, reducing the likelihood of encountering…
Category: Programming
Local AppData is a directory within the Windows operating system where software applications can store data that is specific to the current user. Getting the location of the Local AppData directory for the current user within a .NET application is straightforward. However, currently, there isn’t a .NET API that allows you to get the Local…
When types from another assembly cannot be referenced statically at compile-time in a .NET application, subscribing to events defined in that assembly and subsequently accessing event arguments that are passed to event handlers can seem a little tricky. Thankfully, with the combination of the Reflection API and the dynamic operator, it is possible to subscribe…
It isn’t usually possible to launch a GUI (Graphical User Interface) application from a Windows Service. There are good reasons for this; aside from the security considerations, being interrupted while doing something important by a badly behaving background application would not be fun! However, there are some limited use cases for starting processes that feature…
IdentityModel is an open-source library developed by Dominick Baier and Brock Allen which does an excellent job of simplifying interactions with OAuth 2.0 and OpenID Connect servers. However, when it comes to unit testing, it can appear on the surface to be somewhat difficult to create certain objects that need to be instantiated on demand…
Every process on a Windows device features a ‘command line’ that may include one or more arguments or ‘switches’ that can affect the behaviour of the running program. While it is possible in a .NET application to specify the arguments to use before starting a new process, currently there isn’t an API that allows the…
Windows Services offer a robust mechanism for hosting long-running background applications on Windows devices. These services are usually configured to start with the operating system and can be stopped and started on demand. They are ideal for processing background tasks as they do not show a user interface and therefore do not interfere with what…
Azure Functions is an Azure cloud service that allows software developers to focus on writing code that reacts to events, without needing to concern themselves as much with the infrastructure that the code is running on. Azure Functions applications are serverless by nature and can scale to meet demand with minimal overhead and cost. There…
When it comes to licensing software that is installed on an end user’s device, one of the most secure approaches that we can take as software developers, is to generate and subsequently validate a digitally signed license. With this approach, a cryptographically secure public/private key pair is created that is specific to the software being…