One more month is left behind. One more month till the next release of .NET (the fastest .NET yet). One more issue of .NET R&D Digest to read.
This issue includes bits of software development, windows, diagnostics, performance and low level programming, algorithms, and of course – .NET!
Enjoy your reading!
- Fixed Partitions (by Unmesh Joshi)
Data partitioning is an effective strategy for improving responsiveness and availability of the application data. However, the problem with partitioning is to ensure we can maintain mapping between items in partitions and underlying nodes. In this post Unmesh Joshi describes a “Fixed Partitions” approach which is a way to overcome this and many other problems when you are thinking about partitioning data between multiple nodes. The post is part of the amazing “Patterns of Distributed Systems” series.
- Using multiple JSON serialization settings in ASP.NET Core (by Thomas Levesque)
It is a known feature of ASP.NET Core to support various media types (including custom ones) through formatters. However, what if we need to handle the same media type differently, depending on the application logic? Can we do so? In this post Thomas Levesque demonstrates how you can extend support of JSON media type by supplying different serialisation options for different controllers and actions. A nice post about framework extensibility.
- [C#] Using GC.KeepAlive in async methods (by Kevin Gosse)
Compilers do a lot of good thing for us — they generate code we are bothered to write, they optimise things out and they also warn us about potential issues. But sometimes all these goodies can turn against us 🙂 In this post Kevin Gosse describes an interesting case when combination of multiple internal mechanics clashes and results in a strange and non-obvious issue which you can’t solve if you don’t have enough knowledge about how everything works under the hood.
- Counting the leading zeroes in a binary number with C# (by Andrew Lock)
When it comes to tasks in software development (especially on the interviews) there is a common idea of “knowledge of low level algorithms isn’t needed”. Well, it turns out there are still places where they are needed. In this post Andrew Lock describes an algorithm to count leading zero in a number (represented in binary form). While the task seems to be simple the solution requires a good knowledge of binary arithmetic. As usual — the post is very detailed and easy to follow.
P.S. if you interested in a bit more bit tricks I encourage you to check this post by Sean Eron Anderson.
- .NET Diagnostic IPC protocol: the C++ way (by Christophe Nasarre)
Digging into how things work (even if you don’t use them directly) is the way to better understand how certain scenarios are implemented in practice and learn something new. In the second episode of the deep dive into .NET diagnostics protocol Christophe Nasarre describes how CLR communicates with the diagnostics tools and demonstrates how you can issue a simple diagnostics command. The post is full of C++ sample but don’t worry they are very well documented.
- Working with System.Random and threads safely in .NET Core and .NET Framework (by Andrew Lock)
The more you work with .NET the more you know… you don’t know and forget. That is why it is great to be remainder of something which is a new thing to solve the old issue. In this post Andrew Lock describes the way to use built in .NET random number generator in multi-threaded scenarios and how you can avoid typical pitfalls when doing so. As usual, the post is detailed and full of code samples.
- Performance Improvements in .NET 7 (by Stephen Toub)
Every year before the release of new .NET, Stephen Toub write a huge blog post about performance improvements made in upcoming release. These posts are an immense source of information about framework internals, history of design decisions and of course — performance. The size of these posts was always huge (because of the amount of details) but this one is of size of a small novel 🙂 So, prepare yourself for a long and exciting journey!
- Writing a .NET profiler in C# – Part 1 (by Kevin Gosse)
Writing development tools is a complex but very interesting task. Writing them in a language you like is even more interesting. However, tricking the system to write a tool in a language you like (when initially it seems impossible) is just amazing. In the first post of the series Kevin Gosse describes how to write a .NET profiler in … C#! The post is very interesting because besides the core topic of writing a profiler it also goes into .NET internals. If you are interested in profiler topics I also recommend you read blog by Christophe Nasarre.
- Introduction to Monikers (by Pavel Yosifovich)
COM is a technology that allows you to literally separate your application of some of its dependencies (if they are implemented correctly) but how this separation is implemented? How system understands what component to load? In this post Pavel Yosifovich dives into the COM technology explaining how “monikers” bind opaque strings to objects. The post is full of C++ code but all samples are easy to read and understand.
- Performance Benefits of Using Huge Pages for Code (by Denis Bakhvalov)
Memory management is a complex topic even when it comes to just alloc-free scenarios. But if you take a deeper look in how operating systems and CPU participate in the process it becomes even more tricky and complex. In this post Denis Bakhvalov demonstrates how understanding such complex matters like virtual memory, address translation and memory pages can help you to speed up application execution by optimising memory access to … code, not data.
Tips & Tricks
- Getting user consent before executing sensitive code (by Gérald Barré)
Sensitive operations require additional care. That is why it is better to take more precautions than not. In this tip Gérald Barré demonstrates how you can get user consent on Windows with just a few lines of code.