← All topics

16 articles in the notebook

.NET.

Unsafe reference arithmetic in .NET

A closer look at CompilerServices.Unsafe as the modern alternative to the fixed statement: doing reference arithmetic on GC-managed memory without pinning, what "unsafe" really means, and what the CLR does and doesn't promise you.

Demystifying async/await (with memes)

Async/await looks simple and is widely misunderstood — I have seen entire conference talks get it wrong. A trip down the rabbit hole with examples (and memes) of what the compiler actually does: no, async does not create a thread.

Setting up new .Net projects

After ~30 years and a few thousand projects, this is how I set up new .NET solutions: naming, project structure, .NET Standard vs Core choices — and the reasoning behind each habit. Not a book on architecture, just a clean, consistent setup.

Bug in Mono.Cecil

Mono.Cecil kept producing broken assemblies with branches jumping out of the method — until Jb Evain explained the magic: call Body.Simplify() before modifying and Body.Optimize() after. Not a bug after all.

.Net tools to use: log4net

First in a small series on .NET tools worth using: log4net, Apache's free logging framework. One line at the top of each class, a standard XML section in web.config, and you have proper leveled logging.

.Net tools to use: Nini

.NET tools to use, part two: Nini, an uncommonly powerful configuration library. Reads web.config, .ini and .xml config with type conversion and default values in a couple of lines.

AppDomains

.NET cannot unload an assembly, only a whole AppDomain — so scripts get an AppDomainManager that pools scripts into domains and recycles domains as scripts die.

Book: CLR via C#, Second Edition

The book everyone calls the bible of the CLR arrived a week early. 648 pages between me and a much deeper understanding of what .NET actually does with my code — fuel for the LSO project.

.Net CLR Runtime

Can LSL bytecode map onto .NET CLR? Yes — and here is the biggest Hello World I have ever written, generated at run-time with ILGenerator and OpCodes.