There's a fair bit written about using CodeDom, but samples showing how to implement your own provider have been quite thin on the ground. Fortunately Eden Li, a CLR intern this summer, produced a couple of useful CodeDom provider samples now live on the MSDN BCL site:
- MSIL provider: consumes 1.1-level CodeDom trees and generates textual IL - useful as a relatively complete language-neutral example for folk implementing CodeDom providers targeting other languages.
- Subset provider: consumes 1.1-level CodeDom trees and generates annotated C# source indicating where the tree uses features outside the bounds of the CodeDom Subset (i.e. the set of features all providers must support) - useful when generating CodeDom trees to confirm they should be consumable by all CodeDom providers, regardless of target language.