.NET R&D Digest (February, 2023)

One more month is left behind. A lot of thing happened in a sense of technology (just think of all of the AI things which made their way not only to general public but also in business environment) and a lot more is coming, and while we are waiting for more innovations there is a new issue of .NET R&D Digest to read 🙂

This issue includes stories (more than usual) about past and future, bits of hardware, software development, diagnostics, profiling and of course — a lot of .NET.

Enjoy your reading!

Life & Story

  1. What Happens When A CPU Starts (by Adam)
    Do you know what is happening when you start your computer? In this small and a bit old post Adam describes how CPU and memory are initialised. The post is from distant past but still gives a good high-level overview of what CPU does when you power up your computer. 
  2. What Is ChatGPT Doing … and Why Does It Work? (by Stephen Wolfram)
    In todays world, high quality speech, text and image recognition have become something every «good» software can do. We aren’t surprised when computer can recognise what we say, or allow us to copy some text from an image. It is also not surprising that these things are done using «neural networks». We got used to this (even without deeply understanding how these amazing results are achieved). However, the appearance of ChatGPT have again brought an excitement of what machine can do — now, it can produce a human like text. But… how? In this … detailed … article Stephen Wolfram describes what exactly ChatGPT is doing when generating text and how it actually does this. The article is huge and contains a lot of links and general information about neural networks and machine learning in general.
  3. Advanced lesson in procrastination (by Nemanja Mijailovic)
    It is common for software developers to avoid manual, repetitive work. It is also common to make sure what we say or do has some ground behind it. In combination, these two qualities usually create a trap and we actually spend significant amount of time implementing something which we are going to use once and which can be calculated or, perhaps, estimated in a matter of minutes. In this post Nemanja Mijailovic shares a story of how, calculation of previously purchased albums cost can become an interesting journey for a week of .NET development. The post is fun and easy to read.
  4. 20 Things I’ve Learned in my 20 Years as a Software Engineer (by Justin Etheredge)
    Experience is what usually differentiates juniors from seniors. Participating in multiple projects, working with many, different people and solving various problems — all of this trains our brain and gives us an ability to reason about things and share our knowledge to others. In this post Justin Etheredge describes what he learned during his 20 years career in software development. As usual with such post — some of the things probably will resonate with your own experience and some will not but it still worth reading and thinking through.

Software Development

  1. Examples of problems with integers (by Julia Evans)
    Integer arithmetics is a core part of any modern software because… well we add, multiply and divide numbers all the time. We use integers as keys, we use them in loops and conditions, they are everywhere. That is why integer arithmetic should 100% reliable and there should be no problems with it. Or not? In this post Julia Evans describes a set of problems you might face when using integers in different programming languages. Interesting reminder of how fragile our programs can be.
  2. Building emergency pathways in your software (never to be used) (by Oren Eini)
    Typically, every software system has internal rules of how it should be used «in a right way». These «rules» aren’t always rules of business but also security measures, integration interfaces and other stuff which fits the system into its surroundings. However, even if we have everything to prevent «incorrect» usage things still can go wrong just because there are too many things to take care off. In such cases, we need somehow to «fix» everything. In this post Oren Eini describes «emergency pathways» — a code paths to alternatively do critical things if the «right» way can’t handle it by any reason. The post provokes a good thought — does my software have this? Should it? 


  1. Behind the scenes of minimal APIs (by Andrew Lock)
    Continuation of a great in-depth series about how Minimal API does its magic by Andrew Lock. In these posts you find details about how Minimal API generates argument expressions (for different types of arguments) and response expressions and how all of these combines into a final RequestDelegate.
  2. Mapping ASP.NET Core minimal API endpoints with C# source generators (by João Antunes)
    Dynamic lookup of types implementing a certain interface is a quite common task in many of .NET libraries. Usually it is done through reflection (searching and emiting the code) in runtime. However, since introduction of source generators more and more of such work can be done during compilation. In this post João Antunes demonstrates how you can write a source generator (which in recent versions of .NET has become pretty easy) to automatically register endpoints of classes who implement a certain interface. 
  3. Reading “object” in memory — starting with stacks (by Christophe Nasarre)
    One more episode of the thrilling journey to implement «nettrace» protocol parser by Christophe Nasarre. In this post he demonstrates how to read a generic «object» header and then interpret its payload using a «stack object» as an example. As usual, the post includes detailed C++ code snippets and is easy to follow.
  4. Static and non-static interface member calls in .NET: they are not the same (by Olivier Coanet)
    When interface methods were introduced, it seemed like a questionable feature — I remember long threads about it. However, the feature was shipped and then extended to static abstract methods which gave us generic math and a way to write type traits. What is interesting, it also opened a way to write more performance code. In this post Olivier Coanet does a comparison of how different interface methods are invoked and handled by the JIT compiler. The post contains small assembly code snippets (which isn’t surprising taking in account we are talking about JIT here) but they are quite clear and easy to understand.
  5. How to deploy .NET apps as systemd services using containers (by Tom Deseyn)
    From the beginning, .NET Core (and now .NET) was developed for multiple platforms and operating systems. In latest versions of .NET you can create both: apps that run everywhere and apps tweaked or completely designed for a particular operating system like windows service. In this post Tom Deseyn demonstrates how you can use .NET to write a systemd daemon which runs … in a container and still integrates into the system.

Tips & Tricks

  1. Using source-generated regex in ASP.NET Core route constraints (by Gérald Barré)
    Source generators has a lot of advantages but to use them you need to satisfy certain conditions. This sometimes makes it problematic to use with other parts of the framework. In this short post Gérald Barré shows how you can use regex source generators in ASP .NET Core routing.

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 )

Facebook photo

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

Connecting to %s