All-uppercase strings and `camelCase` JSON serialization (in .NET)

I was recently debugging an issue where two systems expected the contract to be using the camelCase style, but miscommunicated because they assumed a different transformation result for an all-uppercase string like URL: Which of them was right, and which was buggy? The short answer is that there’s no single industry standard defining what is … Read more

SQLiteException: ‘no such collation sequence: unicase’

Recently, I’ve been prototyping various plugins and tools for Anki (flashcard management system) in C#. So far, the biggest technical obstacle I encountered was the following exception thrown when I tried to query data from the database: System.Data.SQLite.SQLiteException: ‘SQL logic error, no such collation sequence: unicase‘ or, when I used Microsoft.Data.Sqlite NuGet package instead of … Read more

Are file operations slower in directories containing many files? NTFS and ReFS (DevDrive) tested

I’ll share the results of a quick benchmark testing how the number of files in a directory impacts the following filesystem operations executed from a .NET application: My motivation was to decide if it was a good design performance-wise to have a single directory containing many cache files. I’m thinking about the order of magnitude … Read more

.NET 7 warning: use ‘GeneratedRegexAttribute’ (SYSLIB1045)

.NET 7 introduced the [GeneratedRegex] attribute that allows doing some regex initialization in compile time rather than in runtime. Using this attribute might help improve performance. Therefore some tooling might start showing you a warning that you miss an opportunity for free performance gains 🙂 SYSLIB1045 Use ‘GeneratedRegexAttribute’ to generate the regular expression implementation at … Read more

Migrate from Jetbrains.Annotations [NotNull] / [CanBeNull] to C# Nullable Reference Types

The most popular feature of JetBrains.Annotations is probably the addition of two cool attributes: [NotNull] and [CanBeNull]. They add a meta-information to a marked element, describing if null is a correct value for that element, or not. Then, developers using ReSharper would get help from the IDE and could easier avoid mistakes like here: I … Read more