- Title: Customizing the Microsoft .NET Framework Common Language Runtime
- Author: Steven Pratschner
- ISBN: 0-7356-1988-3
The book starts of in chapter one by discussing the topic at hand: hosting the CLR and extending it. Hosting as in integrating the CLR with Internet Information Services or SQL Server 2005, extending as replacing some basic services provided by the OS or the .NET Framework irself by your own implementations. Examples of the last are replacing the way assemblies are stored by your own mechanism, replace the threading mechanism by your own mechanism, etc…
Chapter two continuous with explaining the CLR Hosting API: it provides the big picture for hosting the CLR. It explains how the customization of the CLR is divided into hosting managers which are a convenient way to organize the different ways the CLR can be customized. It then continuous with loading the CLR into yor process and how to get at those managers and what hosting managers provide what functionality.
Chapter three then goes into detail on how to start and shutdown the CLR in your process. Allthough you might expect some overlap here with Jeffrey Richter’s or Don Bo’s book, Steven Prachter goes into great detail as to how the process really works.
The next chapter discusses using the default CLR host. The default host is used when running managed applications from the command line or in interoperability scenarios. The chapter sets off with explaining the loading of the default host in the two above scenarios and continuous the explain the default startup options used. It finishes with how some of the startup options can be customized through setup files.
Chapters five and six discuss application domains: the former discusses using them effectively and the latter discusses configuring them. Chapter five starts with discussing the role of application domains (what is their meaning?) and then breaks down the structure of them: list of assemblies, security, properties, etc… It ends the overview by providing some guidelines for partitioning a process into application domains. Then it sets off with discussing the application domain manager (remember how chapter two discussed the partitioning of functionality in managers), that is creation of managers and application domains and finally unloading the domains. Chapter six discusses the various configuration properties available for application domains: what they do and how to set them.
The next two chapters are about assembly loading: chapter seven discusses loading assemblies in extensible applications while chapter eight discusses on how to customize the loading process itself. Chapter seven discusses assembly loading with respect to extensible applications, so don’t expect a recap of general assembly loading: alltough the chapter starts with some general concepts it quickly focuses on extensible applications by discussing the various options for loading assemblies dynamically and the caveats they have. Chapter eight then discusses customizing the loading process itself. Through an example (the Cocoon application) it shows how to customize the packaging of assemblies and then how to, by writing an assembly loading manager, load assemblies from these packages.
Chapter nine then is about Domain Neutral Assemblies. Domain Neutral Assemblies and Code are a feature that enable the sharing of code among several Domains but with redusing the overall memory consumption. The chapter starts with describing the architecture and the implicatiions of using this feature. Next it dsecribes how to use it: how to load assemblies domain neutral.
Chapter ten focuses on extending the CLR security system. After an explanation of the Code Access Security model in the CLR which explains the cooperation between the three pilars of CAS (Evidence, Permissions and Policy) the theory is applied to the Cocoon example started in the chapters seven and eight by implementing a HostSecurityManager.
Chapter eleven is about writing high available .NET Framework applications. The chapter discusses the constructs made available in the .NET Framework 2.0 to be able to safely unload the CLR without any resource leaks when something goes wrong. Concepts explained are safe handles, critical finalizers and constrained execution regions. The chapter also explains the concept of failure escalation which enables you to dictate how certain exceptions should be handled.
The twelveth chapter then is about enforcing application specific programming models. It explains the ability for an etensible application to block certain functionality from being used, like for example displaying user interfaces in a server host. This is done with a feature called Host Protection. After a summary and explanation of the available host protection categories the chapter explains using the feature with again an example extending the Cocoon sample application.
The two last chapters finish the book by explaining how to replace the obtaining of resources from the OS: memory and threads. Chapter thirteen explains writing custom memory managers and configuring the garbage collector while the final chapter explains custom thread schedulers and thread pools.
This is a very interesting book but with a limited public. If you are simply using the .NET Framework for writing applications, then this book is not for you. If you however need to host the CLR in your application then this book is for you. Mind you however that this book is about hosting the CLR and not about interaction with types in the CLR by your unmanaged application.
It is clear Microsoft learned a lot and added a lot of customization features to teh CLR while integrating it with SQL Server 2005 and with this book they are sharing this knowledge.
The style of writing is very pleasant to read. The author not only explains what is possible and how to do it, but also the possible applications of the constructs. So you get not only the how and why, but also the why use it. The code printed in the book is very understandable: it is not a printing of snippets but mostly the whole program gets printed so it is easy to understand the constructs made.
One guy who definitely needs to read this book is Don Box: it will show him how to explain a not so easy subject without boring your public and how to provide a sample code that really shows you something.
What others are saying about this book