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.
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.
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.
By default, ASP.NET validates the dependency injection container configuration at runtime. As a result, we only discover missing or misconfigured dependencies when the application runs. While this approach works, getting feedback at the build time would be a time saver.
As we moved from .Net Full Framework to .NET 6, we had to use the little hack of creating a AssemblyInfo.cs file and put this content into it to access the internal classes and methods from our test project:
With Windows 11 came a new context menu in the file explorer. What before was a one click action, now takes us two steps:
We right-click on the file to open the first context menu:
Now we need to click on "Show more options" to get the Windows 10 context menu:
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.
In C# we have two ways to initialise a dictionary. While both give us a dictionary in the end, there is a small but important difference when it comes to duplicated values. Let us explore the difference.
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.
stringCombine(stringaddress,stringcity,stringzipCode){if(address==null){thrownewArgumentNullException(nameof(address));}if(String.IsNullOrEmpty(city)){thrownewArgumentNullException(nameof(city));}if(String.IsNullOrWhiteSpace(zipCode)){thrownewArgumentNullException(nameof(zipCode));}// Do the workreturn$"{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?