Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good.
The only CIL book on my shelf is Expert .NET 2.0 IL Assembler by Serge Lidin. In terms of what the individual opcodes do or mean, the Microsoft documentation on System.Reflection.Emit has some pretty good information. And it's always useful to look at existing IL with Reflector.
Edit: CIL (and indeed the CLR in general) has not changed at all between .NET 2.0 and .NET 3.5 -- the underlying runtime is basically the same, modulo fixes and performance improvements. So there's nothing newer available on a CIL level than what would be in a book on 2.0
Expert .NET 2.0 IL Assembler rocks because the author writes well and includes every freaking detail you can imagine. It doesn't hurt that he wrote the IL assembler, disassembler and validator. Best of all you can buy it in a PDF instead of a dead tree.
Masochists interested in compiler development will also enjoy Compiling for the .NET Common Language Runtime by John Gough. I found this book immensely helpful during a virtual machine development project where I "stole" lots of ideas from the CLR design.
Expert .NET 2.0 IL Assembler by Serge Lidin
There was a 1.1 version of the same book, but I haven't seen anything for the latest .NET release. It's an excellent book. I used it to write an OCR component in MSIL, as a learning project.
[Edit] @Curt is right, 3.0 and 3.5 are just extensions to 2.0, I hadn't plugged that in to my head yet. Now I've thought of a fun geek project... compare the disassembly of standard 2.0 code to the new LINQ/Lambda way of performing common tasks like filtering lists. For some reason I assumed that the magic was happening in new IL features, not just the compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With