.NET R&D Digest (January, 2023)

I might be hard to believe but the first month of the 2023 has already passed. Technology world is moving forward to introduce new and fantastic features like this, intriguing, Blazor update, prepare for upcoming conferences and innovations. In addition to of all these fabulous things, new year also brings a new issue of .NET R&D Digest.

This issue includes bits of C#, diagnostics, performance, operating systems, clouds a few stories and of course .NET and .NET Internals.

Have a nice read!

Developers Story

  1. No Start Menu for You (by Bruce Dawson)
    Responsiveness is a key of “fast” applications. Even small hangs can annoy users so they can decide to drop using the app. In this post Bruce Dawson tells the story of an in depth investigation of Windows Start Menu issue. The post is detailed and includes link to tools and guides, so you can verify if your system suffers from the same problem. 
  2. Reverse engineering yet another ebook format (by Nemanja Mijailovic)
    In the todays world purchasing something doesn’t always mean that you started to own something. More and more it just means you are purchasing the right to access something for some limited (or unlimited) time. To make this work sellers either use some form of digital protection (i.e., DRM) or custom tools. In both cases you are forced to either use a tool you don’t like, have a constant internet connection and so on. In this post Nemanja Mijailovic shares how he used the knowledge of web development, Google and ebook formats was able to reverse engineer the digital format of a recently purchased ebook.

Software Development

  1. Logging practices I follow (by Eliran Turgeman)
    No matter what kind of application you are writing — distributed system or windows service — logging is crucial. Why? Because we write these logs for future self or for those who are going to diagnose and solve issues. In this post Eliran Turgeman shares a set of logging practices to write compact and consistent logs.

.NET

  1. 37 Misconceptions about date and time (by Gérald Barré)
    One minute consists of 60 seconds, one hour of 60 minutes and one year of 365 days. Sounds simple? In most cases yes. However besides well-known cases like leap year there are a lot of tricky and strange edge cases which makes time related development very hard. In this post Gérald Barré describes a lot of common misconceptions about calendars, dates and time zones. 
  2. Writing a .NET profiler in C# — Part 2 (by Kevin Gosse)
    It has been awhile but the saga of writing a .NET profiler in C# continues. In this post Kevin Gosse continues the effort of making a COM object more C#-ish by demonstrating how we can «replace» usage of class static methods from the previous post with more convenient use of class instances. This series is a great source of low-level .NET knowledge — don’t miss it.
  3. Getting rid of warnings with nullable reference types and JSON object models in C# (by Maarten Balliauw)
    From time to time it feels like software development is all about repeating the same thing again and again, so everything can be standardised and reused. But the trick here is in small, sometimes even tiny details. This works for both — shared classes, frameworks and compiler features. «Nullable types» is a great feature but in many web development scenarios it can produce significant false positives noice. In such situations it is very tempting to turn them off but there is another way. In this post Maarten Balliauw shares a set of tips of how to “bend” «nullable types» to your advantage when working with JSON based DTOs.
  4. Developing distributed applications with Tye and Using LocalStack with Microsoft Tye (by Renato Golia)
    Micro-services approach is always advertised for its advantages. However, as any other architecture approach it has own disadvantages and in case of micro-services it usually comes at a cost of development experience. Here is where projects like Tye really helps to mitigate the issues. In these posts Renato Golia does a great introduction into the Project Tye capabilities, explaining what it can do (please note the post date, since then there were several releases which have introduced some of the things but besides this the description is still actual), and demonstrates how it can really simplify development with localstack.
  5. Behind the scenes of minimal APIs (by Andrew Lock)
    Introduction of Minimal API in .NET 6 has opened a way to write .NET web applications in just a few lines of code. As usually, this is achieved through multiple levels of abstraction, extension methods, builders, factories and of course a cleaver architecture design. In this series Andrew Lock describes the internals of the Minimal API, starting from unveiled details of how a simple lambda becomes a high speed endpoint. As usual, all posts are very detailed, with code snippets and comments.
  6. How to make the fastest .NET Serializer with .NET 7 / C# 11, case of MemoryPack (by Yoshifumi Kawai)
    Serialisation and deserialisation are the processes of transforming an instance of object (or value) to and from a stream of bytes. However, the complexity, and therefore performance challenges, of these processes arise from the fact that in C# you can’t just dump memory to a stream to serialise things, well at least not always. In this post Yoshifumi Kawai describes a new C# oriented serialiser which utilises every trick of the language and framework to get as much performance as possible. Besides the post I recommend you to take a look at the README.md file in the repository to get better understanding of the corner cases and limitations.
  7. How the heap verification mode helps with debugging heap corruption (by Maoni Stephens)
    .NET GC is extremely complex piece of software. In practice that means — a lot of things can go wrong and finding what actually happened is hard. That is why many such systems have a self-diagnosis routines which are designed specifically to narrow the problem scope. In this post Maoni Stephens describes what is GC verification mode and how it helps to diagnose GC issues. As usual, this post is a gold if you like .NET internals stuff.

Diagnostics

  1. Production postmortem: The heisenbug server (by Oren Eini)
    There are a lot of jokes about how debugging is similar to detectives work. Indeed, you are looking for clues and trying to re-create a big picture. Sometimes, what you see makes no sense but as Sherlock Holmes said “when you have eliminated the impossible, whatever remains, however improbable, must be the truth”. In this post Oren Eini tells a story of a very tricky issue which was and wasn’t there at the same time. Great story.

Windows

  1. Introduction to the Windows Filtering Platform (by Pavel Yosifovich)
    It isn’t a surprise that network stacks in modern operating system is complex (at least this is what we are tend to hear when it comes to networking) but it is rarely mentioned, that besides being complex in general, network stack in operating system should also be extensible. In this post, which is actually a chapter of the upcoming second part of the Windows 10 System Programming, Pavel Yosifovich describes the basic structure of windows network stack and explains how using Windows Filtering Framework API  developers can extend it with custom filters (for example to prevent calculator app from using the internet).

Tips & Tricks

  1. C# 11 List Patterns – Create compatible types (by Gérald Barré)
    C# as a language offers many features but one of the greatest part the language is that most of the language features aren’t fixed on framework or “special “ classes but instead can be extended with the classes we can write. In this short blog post Gérald Barré shares a tip of how you can make you classes compatible with the new C#11 “pattern matching for lists” feature.
  2. Detecting breaking changes between two versions of a NuGet package at packaging time (by Gérald Barré)
    Maintaining a library or a package is thought, especially because you can’t validate all possible usage of the code you release (you can write a lot of tests and samples but this still be just a subset of all possible usage scenarios). That is why it is great to see that .NET ecosystem evolves to help you deal with it. In this short tip Gérald Barré describes how you can enable breaking changes validation in dotnet pack command to minimise the possibility or releasing something incompatible.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s