.NET R&D Digest (November, 2021)

Here it comes – a last (but not least) month of the year, December. This month is mostly famous because of New Year celebration but this year I hope it also will become recognised because there will be two issues of .NET R&D Digest to read – one for November (this one) and one for December (expected to be available closer to the end of the month).

This issues includes bits of software development, architecture, .NET (and .NET Internals), debugging, diagnostics, tools and compilers!

Have a nice read and have fun 🙂

Software Development

  1. Multi-tenant Architecture for SaaS (by Derek Comartin)
    SaaS applications are almost everywhere. In fact, a lot of mobile and web apps you use on daily basis are SaaS. One of the characteristics of SaaS is an ability to serve multiple users from multiple organisations — multi-tenancy. In this post Derek Comartin provides a detailed description of what multi-tenancy is and demonstrates various forms it might take, underlining common pros and cons.
  2. Compliance in a DevOps Culture (by Carl Nygard)
    Making sure that the product delivered to production is of high quality, is an essential part of delivering value. However, besides technical quality there are other things we should care about and these things are usually described in standards and government mandates. How to make sure our product meets them? How to incorporate these compliance checks into development cycle? In this post Carl Nygard describes what compliance is and how it can be implemented and integrated into development life cycle.
  3. The strong and weak forces of architecture (by Evan Bottcher)
    Organising work, technology decisions and integrations between teams, requires governance which need to be different on different levels. In this post Evan Bottcher describes an approach taken in MYOB company — the alignment of forces, where the more force (alignment) you have the more agility your teams might have by spending less time on backward compatibility, versioning and technology selection.
  4. A Design Analysis of Cloud-based Microservices Architecture at Netflix (by Nguyen Cao)
    How do you design a system for millions of users? What should you think of? What trade offs should you take? For every project these questions will have different answers. That is why it is great to see what others do. In this post Nguyen Cao does an in depth analysis of Netflix cloud-based architecture (based on the open sources) describing core elements, their relationships and trade offs posted by the design.

.NET

  1. Improving logging performance with source generators (by Andrew Lock)
    All applications have logs. Writing logs in a correct and performant way requires both application and library authors to put a significant effort in it — from the app side it is to use all constructions provided by library and from library it is to provide such constructions. However, usually it turns to be a lot of code no one really enjoys to write. Therefore, application developers are tend to use simplest and usually not the most performant ways. In this post Andrew Lock demonstrates how you can use newly introduced (in .NET 6) source generators to automatically generate logging code which is simple and efficient.
  2. Configuring dotnet-monitor with Prometheus and Grafana (by Konrad Kokosa)
    Having your application monitored is important and it is great when you can monitor your application without actually changing the code. In this Konrad Kokosa demonstrates how you can enable monitoring for your .NET application with a few containers: dotnet-monitor, Prometheus and Grafana. The post contains everything you need to run the demo and try it yourself.
  3. Source generator updates: incremental generators (by Andrew Lock)
    Source generators introduced in .NET 5 is a great feature but as all cool features related to real time editing they had a cost and sometimes might cause IDE to lag and freeze. However, it is fixed now 🙂 In this post Andrew Lock describes the problem with previous generation of source generators and demonstrates new incremental generators in action. The post is detailed and contains a lot of code snippets.
  4. Reading parameters value with the .NET Profiling APIs (by Christophe Nasarre)
    The journey into debugger land continues with the fourth post. In this post Christophe Nasarre demonstrates how you can read parameter’s value using CLR debug interface. In addition to the above, the post also demonstrates an importance of understanding how object (and strings in particular) are implemented. As usual, despite all code is written in C++ it is easy to understand and don’t require knowledge of language specifics.
  5. Announcing YARP 1.0 Release (by Sam Spencer)
    If you were asked about reverse proxy, what would you say? I think, there is a high probability that the response will include a word NGINX 🙂 However, now it might be one more answer – YARP, an open-source reverse proxy written in .NET. In this post Sam Spencer introduces YARP and describes it benefits and how it can be used. Please don’t forget to check comments!
  6. A quick review of C# 10 new language features (by Thomas Levesque)
    Every version of C# brings a lot of new features. Making language simpler and more complex at the same time. Some features we use on daily basis and some we don’t touch for decades. In this post Thomas Levesque does an overview of new features introduced in C# 10. Each feature is accompanied by a source code sample and detailed description. Informative and easy to read.
  7. The code review bug that gives me nightmares (Part 1, Part 2 and Part 3) (by Oren Eini)
    If you think about memory management in .NET, there are a few basic rules: avoid unnecessary allocations and avoid finalizers. However, sometimes you need to break these rules. In this post Oren Eini demonstrates how you can allocate a finalizable object and use it to produce clean and elegant solution to complex concurrency problem. 
  8. How not to read a string from an UTF-8 stream (by Gérald Barré)
    Have you ever read something from a stream (ex. string)? I bet it was quite simple because you can just specify the amount of byte to read and that is it. However, sometimes you can’t 🙂 In this post Gérald Barré describes a situation where simple and direct read of string from a stream isn’t a case and can lead to incorrect results. Besides problem description the post also contains solution and future guidance.
  9. [CallerArgumentExpression] and throw helpers (by Andrew Lock)
    Can you imagine compiler helping you identify runtime errors? Sounds a bit weird but in C#10 (and .NET 6) it is true. In this post Andrew Lock describes a new compiler attribute introduced in C#10. This attribute in combination with previously introduced attributes (also covered in the post) allows you to produce exceptions enriched with the information about their source which can significantly simplify things. As usual, the post contains code snippets and easy to read.

Diagnostics

  1. Debugging memory corruption: who the hell writes “2” into my stack?! (by Tautvydas Ĺ˝ilys)
    Bugs can be sophisticated, especially when they involve multiple threads. However, sometimes bugs can be so unpredictable that finding a reason could be a real story with twists and turns. In this post Tautvydas Žilys describes an issue he faced in Unity engine which at the first glance was kind of buffer overflow, and tools five days to solve. This post is about windows, includes C++, memory and assembly. But what is fun — it requires just a simple understanding of stack to get it.

Watch and Learn

  1. 2016 LLVM Developers’ Meeting: Z. Ansari “Causes of Performance Instability due to Code …” (by Zia Ansari)
    Have you ever experienced significant performance swings after seemingly insignificant change? In this talk, Zia Ansari explores some of the common and not so common architectural reasons why code placement and alignment can affect performance on x86 processors. Besides describing the cases Zia also shares how they could be avoided and recognised.

Tools

  1. .NET Digital Library
    It is quite a common thing to hear that AWS is not very friendly for .NET development. Maybe it was true previously but things change and AWS now has a huge set of tutorials and docs on how to do .NET on AWS.
  2. VSExtensibility repository
    Visual Studio 2020 introduced a lot of changes on how extensions are integrated into the app. To catchup, check out this repository for announcements, guides and updates.

Interesting

  1. Incomplete List of Mistakes in the Design of CSS
    Just a list of things to correct in CSS if someone invents a time machine 🙂

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