Book Review: Customizing the Microsoft .NET Framework Common Language Runtime

Heath Stewart

As you might have noticed from various posts on my blog I love understanding how things work. When I started learning the Microsoft .NET Framework 1.0 I delved into intermediate language (IL) for most of the assemblies and learned about the hosting interfaces. If you have such a passion for learning how things work then Customizing the Microsoft .NET Framework Common Language Runtime from MS Press by Steven Pratschner is the book for you.

Customizing the Microsoft .NET Framework Common Language Runtime delves into all the hosting interfaces and features of the .NET Framework 2.0. There’s a lot of new control provided by the new hosting interfaces over the original hosting interfaces in .NET 1.0 and 1.1. Pratschner walks you through starting up and shutting down the Common Language Runtime (CLR), to configuring and securing application domains, all the way to optimizing performance for your host by managing memory used by the CLR to scheduling tasks and creating synchronization primitives. All the while he builds on a sample application that uses OLE structured storage documents to bundle custom managed assemblies and refers a lot to SQL Server 2005 – a driving force for many of the new hosting interfaces because of their strict requirement for memory management and task scheduling.

There is a lot of new interfaces available starting with .NET 2.0. A common naming convention helps to keep all these interfaces straight. It all starts in the same way as hosting the CLR for .NET 1.0 and 1.1: calling the CorBindToRuntimeEx function. For the new hosting interfaces, however, you must pass CLSID_CLRRuntimeHost for the rclsid parameter and IID_ICLRRuntimeHost for the riid parameter. From the returned pointer to the ICLRRuntimeHost interface you can get manager interfaces implemented by the CLR as well as provide manager interfaces implemented by your own host.

Pratschner keeps the book interesting and covers a lot of detail without very little redundancy (enough of what I consider helpful). The example host, called Cocoon, does a great job of demonstrating many of the hosting interfaces Pratschner describes, and is a great addition to the examples in the .NET Framework 2.0 SDK.

If you like understanding how things work, or want to host the CLR in your own application beyond COM interoperability, you should definitely read Customizing the Microsoft .NET Framework Common Language Runtime from MS Press by Steven Pratschner.


Comments are closed. Login to edit/delete your existing comments

Feedback usabilla icon