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

Is it a good practice to treat warnings as errors?

Making Visual Studio treat warnings the same way as errors .NET projects have an interesting property that we can set. It’s named TreatWarningsAsErrors. We can set it in *.csproj files: For years, I would say that this is great! The more strict code checking rules, the better, right? Code style, warnings, conventions. And in theory, … Read more