Skip to content

Blog

Change the SSL Certificate of the Octopus Deploy Server

Renewing SSL certificates for applications we deploy with Octopus Deploy is a straightforward task. We can go to the certificate store, replace the old certificate with the new one and the next time we deploy the certificate is on the server. If we need to update the certificate for Octopus Deploy itself, we need to go through more hoops that are not as clear. Let us see what we need to do.

Find Outdated Packages in .NET Projects

Packages get outdated in no time. Keeping your dependencies up to date is not only a good thing, but because of the many security issues also an important task. It is already a few years since I wrote about the little .NET helper libyear. While this tool is still under active development and does its job the same way as it did in 2019, it is time to see what new tools could help us to keep an eye on our dependencies.

A nice little helper I found is dotnet-outdated, that gives us a detailed list of our projects and the outdated packages.

How to Track Down the Elusive 0x00 Character in Your Data

There are a whole bunch of non-printable characters in ASCII like tabulator, end of medium or shift in that sometimes finds its way into a user input. This often happens when copy and pasting data from Microsoft Office.

We can find most of those special characters by copying the data from SQL Server Management Studio into Notepad++. A little visible indicator is all we need to find the special character and remove it. However, 0x00 represents NULL and has no visual indicator, what makes it uncatchable for our usual process.

Last week we got this exception that started an unprecedented hunt for a special character:

System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. at System.Xml.XmlConvert.VerifyCharData(String data, ExceptionType invCharExceptionType, ExceptionType invSurrogateExceptionType)

We checked, double-checked and triple-checked all the data and found nothing. We fixed a bunch of entries, but nothing changed. The exception kept showing up.

How to Fix the Context Menu of Windows 11

With Windows 11 came a new context menu in the file explorer. What before was a one click action, now takes us two steps:

  1. We right-click on the file to open the first context menu: The new context menu shows up.
  2. Now we need to click on "Show more options" to get the Windows 10 context menu: The old context menu with the helpful options.

So far, I accepted this extra step as the price to get all the other Windows 11 benefits. But as it turns out, this is unnecessary. We can get the old context menu back with a single entry in the registry.

Create Sortable GUIDs With UUID Version 7 in .NET

GUIDs are great for generating unique identifiers across distributed systems, since they need no centralised coordination and are globally unique. But their randomness comes with a price tag when we use them in relational databases: fragmented indexes, slower inserts, and no sense of order.

Since .NET 9 we get an out of the box solution that fixes this problem: UUID version 7. We can keep the upsides of a GUID while we can get rid of the downsides - by just using a different method to create our identifiers. Let us explore how that works.

A Shorter Way for Null Guard Clauses in C

When we want to make sure that our method only accepts values that are not null, we can write guard clauses like these on top of the method:

string Combine(string address, string city, string zipCode)
{
    if(address == null)
    {
        throw new ArgumentNullException(nameof(address));
    }
    if(String.IsNullOrEmpty(city))
    {
        throw new ArgumentNullException(nameof(city));
    }
    if(String.IsNullOrWhiteSpace(zipCode))
    {
        throw new ArgumentNullException(nameof(zipCode));
    }

    // Do the work
    return $"{address} - {zipCode} {city}";
}

That works, but as you can see in this little example, this uses many more lines to check the data than it uses to do the work itself. Is there a better way to get this functionality?