Resources for Learning about .NET Internals
22 Jan 2018 - 2426 wordsIt all started with a tweet, which seemed to resonate with people:
If you like reading my posts on .NET internals, you'll like all these other blogs. So I've put them together in a thread for you!!
— Matt Warren (@matthewwarren) January 12, 2018
The aim was to list blogs that specifically cover .NET internals at a low-level or to put it another way, blogs that answer the question how does feature ‘X’ work, under-the-hood. The list includes either typical posts for that blog, or just some of my favourites!
Note: for a wider list of .NET and performance related blogs see Awesome .NET Performance by Adam Sitnik
I wouldn’t recommend reading through the entire list, at least not in one go, your brain will probably melt. Picks some posts/topics that interest you and start with those.
Finally, bear in mind that some of the posts are over 10 years old, so there’s a chance that things have changed since then (however, in my experience, the low-levels parts of the CLR are more stable). If you want to double-check the latest behaviour, you’re best option is to read the source!
Community or Non-Microsoft Blogs
These blogs are all written by non-Microsoft employees (AFAICT), or if they do work for Microsoft, they don’t work directly on the CLR. If I’ve missed any interesting blogs out, please let me know!
Special mention goes to Sasha Goldshtein, he’s been blogging about this longer than anyone!!
- Dissecting the code by Sergey Teplyakov (@STeplyakov) (M/S)
- Understanding different GC modes with Concurrency Visualizer
- Garbage collection and variable lifetime tracking
- Managed object internals, Part 1. The layout (Also part 2, part 3 and part 4)
- To box or not to Box? That is the question!
- Dissecting the new() constraint in C#: a perfect example of a leaky abstraction
- Adam Sitnik - .NET Performance and Reliability by Adam Sitnik (@SitnikAdam) (M/S)
- Andrey Akinshin’s blog by Andrey Akinshin (@andrey_akinshin)
- TooSlowException by Konrad Kokosa (@konradkokosa)
- a little bit of programming by Marcin Juraszek (@mmjuraszek) (M/S)
- yizhang82’s blog by Yi Zhang (@yizhang82) (M/S)
- Timur Guev’s posts on {coding}Sight by Timur Guev (@timyrik200), also appears to have his own blog Math and Programming (in Russian)
- The mole is digging by Alexandr Nikitin (@nikitin_a_a)
- My Coding Place by Dudi Keleti (@dudi_ke)
- Alexandre Mutel’s blog by Alexandre Mutel (@xoofx)
Update: I missed out a few blogs and learnt about some new ones:
Honourable mention goes to .NET Type Internals - From a Microsoft CLR Perspective on CodeProject, it’s a great article!!
- Performance is everything. But correctness comes first. by Alois Kraus (also includes some great posts on Windows Internals and Debugging, such as Windows 10 Memory Compression And More and How Buffered IO Can Ruin Performance)
- Entropy Overload by Barry Kelly
- Matthew Skelton’s blog by Matthew Skelton
- .Net Internals, Debugging, Multithreading - and More! by Liran Chen
- Maarten Balliauw {blog} by Maarten Balliauw
- tabs ↹ over ␣ ␣ ␣ spaces by Jiri Cincura
- NTCore (also writes on the Cerbero Blog) by Daniel Pistelli
- DOT NET TRICKS by Abhishek Sur (@abhi2434)
- Random IT Utensils by Adam Furmanek
- Custom memory allocation in C# Part 1 — Allocating object on a stack
- Custom memory allocation in C# Part 6 — Memory errors
- .NET Inside Out Part 1 — Virtual and non-virtual calls in C#
- .NET Inside Out Part 4 — How to override sealed function in C# Revisited
- .NET Inside Out Part 7 — Generating Func from a bunch of bytes in C#
- Redgate ‘Simple Talk’ posts by Simon Cooper
- Ayende @ Rahien by Oren Eini
- Low Level Design by Sebastian Solnica (he’s also done some great presentations)
- Welcome to the Corner of Excellence by Eka Siswanto now hosted at https://excellentcorner.com/
- Steve’s Tech Blog by Steven Niemitz
- Mode 13h by Dustin Metzgar (author of .NET Core in Action)
Book of the Runtime (BotR)
The BotR deserves it’s own section (thanks to svick to reminding me about it).
If you haven’t heard of the BotR before, there’s a nice FAQ that explains what it is:
The Book of the Runtime is a set of documents that describe components in the CLR and BCL. They are intended to focus more on architecture and invariants and not an annotated description of the codebase.
It was originally created within Microsoft in ~2007, including this document. Developers were responsible to document their feature areas. This helped new devs joining the team and also helped share the product architecture across the team.
To find your way around it, I recommend starting with the table of contents and then diving in.
Note: It’s written for developers working on the CLR, so it’s not an introductory document. I’d recommend reading some of the other blog posts first, then referring to the BotR once you have the basic knowledge. For instance many of my blog posts started with me reading a chapter from the BotR, not fully understanding it, going away and learning some more, writing up what I found and then pointing people to the relevant BotR page for more information.
Microsoft Engineers
The blogs below are written by the actual engineers who worked on, designed or managed various parts of the CLR, so they give a deep insight (again, if I’ve missed any blogs out, please let me know):
- Maoni’s WebLog - CLR Garbage Collector by Maoni Stephens
- cbrumme’s WebLog by Christopher Brumme
- A blog on coding, .NET, .NET Compact Framework and life in general.. by Abhinaba Basu
- Joel Pobar’s CLR weblog - CLR Program Manager: Reflection, LCG, Generics and the type system.. by Joel Pobar
- CLR Profiling API Blog - Info about the Common Language Runtime’s Profiling API by David Broman (slightly niche, but still worth a read)
- Yun Jin’s WebLog CLR internals, Rotor code explanation, CLR debugging tips, trivial debugging notes, .NET programming pitfalls by Yun Jin
- JIT, NGen, and other Managed Code Generation Stuff - Details about RyuJIT stuff of all sort.. by various
- Distributed Matters - Troubleshooting issues in technologies available to developers for building distributed applications by Carlo
- B# .NET Blog - BART DE SMET’S on-line blog (0X2B | ~0X2B, THAT’S THE QUESTION) by Bart De Smet
- Nate McMaster’s blog by Nate McMaster
Books
Finally, if you prefer reading off-line there are some decent books that discuss .NET Internals (Note: all links are Amazon Affiliate links):
- CLR via C#, 4ed by Jeffrey Richter
- Shared Source CLI Essentials Paperback by David Stutz, Ted Neward, Geoff Shilling Ted (Ted Neward also made a pdf version available to download from his web site)
- Writing High-Performance .NET Code Paperback by Ben Watson
- His blog is also worth reading, e.g. Digging Into .NET Object Allocation Fundamentals and Digging Into .NET Loop Performance, Bounds-checking, Iteration, and Unrolling
- Pro .NET Performance: Optimize Your C# Applications by Sasha Goldshtein
All the books listed above I own copies of and I’ve read cover-to-cover, they’re fantastic resources.
I’ve also been recently recommend the 2 books below, they look good and certainly the authors know their stuff, but I haven’t read them yet:
- The Common Language Infrastructure Annotated Standard by James S. Miller, Susann Ragsdale
- Essential .NET, Volume I: The Common Language Runtime by Don Box, Chris Sells
*New Release*
- Pro .NET Memory Management: For Better Code, Performance, and Scalability by Konrad Kokosa (Nov 2018)
Discuss this post on HackerNews and /r/programming