The first day of spring is here! So it is time for a new issue of .NET R&D Digest!
A fun fact is that I first started to publish this digest internally within the company and it’s internal number is #24, so it is been two years since the first digest issue 😊
This issue contains bits of Life & Story, Architecture, .NET, .NET Internals, C# and tools.
Enjoy your reading!
Life & Story
- How to become a better developer by asking questions (by Steve Gordon)
Software developments isn’t about writing code. It is more about solving problems using code. And sometimes you can’t solve a problem or even understand the reason of the problem without asking for help or clarifying things. In this post Steve Gordon shares a piece of advice (a large one) about how to ask questions, what to do before asking questions, when to ask questions and the most important – how not to be afraid to ask questions.
- Reflections on writing a book (Intro, Part 1, Part 2) (by Denis Bakhvalov)
Writing a book is definitely something that takes a huge amount of effort, self-discipline and dedication. In this posts Denis Bakhvalov shares his experience about writing a free eBook from scratch (including description of tools used for writing and reviewing; technics to keep the process going and more).
- Data Mesh Principles and Logical Architecture (by Zhamak Dehghani)
It is hard to image a system which doesn’t have data inside it (at least it should have some data to operate). In contrary, modern systems collect tons of data which is later analyzed and used to for different business purposes. While this seems natural it is sometimes hard to imaging size of this data and complexities of using this data, especially when it comes from multiple organization units. In this post Zhamak Dehghani introduces principles of data mesh approach and describes how these principles brings analytical and operation data closer while maintaining data source independence. Besides a very interesting writeup this post includes multiple links and references which are worth reading.
- Beautiful and compact Web APIs with C# 9, .NET 5.0 and ASP.NET Core (by Filip W)
Besides major features like source generators, C#9 continues to introduce new ways of omitting language ceremonies and writing a more compact (and sometimes a bit scriptish) code. In this post Filip W demonstrates how you can use these kind of features to write a fully-fletched ASP.NET Core service (with authentication, authorization and routing) that nicely fits in a single
- Export Office 365 calendar events to JetBrains Space using the Microsoft Graph API, the JetBrains Space SDK, and automation (by Maarten Balliauw)
If you catch yourself doing the same thing over and over again then, it is time to automate it. However, proper automation requires ability to manipulate and gather information about objects of interest. In this post Maarten Balliauw demonstrates how you can implement synchronization of two independent calendars, one hosted in Microsoft Office 365 and another is on JetBrains Spaces, using available SDK packages for Microsoft Graph API and JetBrains Spaces. While described solution may look very platform specific the overall approach and some hints like how to distinguish event to synchronize can be extrapolated to many other, similar problems.
- .NET Memory Performance Analysis (by Maoni Stephens)
This amazing document by Maoni Stephens is a detailed handbook for .NET memory performance analysis and everyone who cares about application performance. Besides .NET GC insights and theory, it also includes many concrete situations with detailed instructions of how you verify them and find the root of the problem. In addition to the above it also includes introduction to PerfView tool and many ready to use PerfView commands to collects particular GC events. This one is must save 🙂
- Debugging a native deadlock in a .NET Linux application (by Kevin Gosse)
One night (this isn’t necessary true, but night always sounds more dramatic). On one Linux machine. One app … stuck. Why? Who is behind this? Only a software engineer can answer these questions. In this post Kevin Gosse shares a story about an app who stuck in the middle of nowhere without an obvious reason. A case when asynchronous call caused a deadlock (no more spoilers!). Besides the main story this post also contains bits of diagnostics information about how to simplify setup of LLDB and download symbols for captured memory dump using dotnet tools.
- Should I use self-contained or framework-dependent publishing in Docker images? (by Andrew Lock)
Nowadays, when disk space is cheap, is there a reason to save another 40 MB? It depends on what this 40 MB really mean. If they are about an application size installed on PC then, perhaps this is not a problem, however if we are talking about dozens of images stored in container registry then having ‘extra’ 40 MB might become an issue. In this post Andrew Lock shares results of his research regarding what .NET deployment model (framework based or self-contained) to use when deploying you application in Docker container. Besides doing a comparison, this post also includes a short overview of both deployment models.
- ASP.NET Core dependency injection: what is the IServiceCollection? (by Steve Gordon)
Dependency injection became an essential part of .NET Core (.NET 5?) applications (even in console apps). And while general concept of dependency injection is widely adopted and understood, .NET Core dependency injection implementation has its own pearls and features. In this post Steve Gordon describes basics about what dependency injection is, what service lifetime is and demonstrated multiple ways of how you can register dependencies and what effect you can achieve.
- Playing with C#9 top-level programs, records and ELASTICSEARCH.NET (by Steve Gordon)
C# constantly evolves and introduces more and more features. Some of these features might seem doubtable, strange, or useless to long time language users, however they emerged to the language for purpose, so why not to try them? In this post Steve Gordon demonstrates how you can use records, top level program and local functions together to write simple and compact sample application without any kind of language boilerplate.
- An introduction to the Data Protection system in ASP.NET Core (by Andrew Lock)
Security is critical for any morn application, and in modern frameworks a lot of security boilerplate is handled by framework itself. However, it is still important to understand what framework does and why. In this post Andrew Lock explains basics of ASP.NET Core data protection system: where it is used, how it work, what are the core elements and logic behind them. Besides detailed theoretical part the post also includes useful link for in-depth study of data protection topic.
- kalk (by Alexandre Mutel)
I think, every digital device has a built-in calculator, which isn’t surprising because well… machines were designed to calculate things 🙂 In Windows calculator there is also a programmer mode with bitwise operations and multiple number representation but what about a calculator that can work with arrays? Use hardware intrinsics? Convert units? Work inside beloved terminal?! 🙂 If that is what you really need, then kalk by Alexandre Mutel is the tool. A small command line utility with build in functions to work on numbers, arrays, hardware intrinsics; integrated help and modules support (to extend built-in functionality) and many more. It is also distributed through Windows Store and nicely integrates with Windows Terminal 🙂