Peter Drayton's .NET Goodies

This is a list of tools/samples/etc. that I've created while exploring the .NET framework and the C# programming language. Hopefully, you will find some of these useful - feel free to take anything here and use it in your own programs or dev environment. All I ask is:

  1. If you release source code, please credit me & reference this site.
  2. Don't deep-link directly to the *.zip files - link to this page.
Thanks, and enjoy learning .NET!
--Peter


My Radio Weblog
If you're looking for my weblog, follow the link above. It contains random, regularly updated commentary on the CLR, the CLI, C#, the .NET Framework, and the occasional XML and Web Services topics.


TestModules
A multi-module assembly is an assembly that contains multiple modules (DLLs). This has a range of uses, including creating multi-language assemblies (assemblies created in more than one .NET language), and more closely controlling application working set size. This is a demonstration of the use of multi-module assemblies to control application working set size, which is a handy optimization if you need that sort of thing. This sample also demonstrates dynamic binding via Reflection. In order to get the most from the sample, I suggest you read the ReadMe file included in the distribution, and download Filemon from


TraceHook.NET
The TraceHook.NET service is a CLR context attribute that provides automatic call tracing on attributed classes. It traces instance method calls & field/property accesses to the debug output, allowing one to monitor an application as it runs. The trace includes type names, method names, parameter names & values (both [in] & [out]), as well as any return codes or thrown exceptions. Full, commented source is included, thus it should also serve as an interesting demonstration of the use of context attributes & interception in the .NET platform.


Reverse-engineered source for UnwindScope by Don Box
This is reverse-engineered source code for Don Box's UnwindScope CLR context attribute. For the original distribution (sans source!), go here. Although this source compiles fine and functions as a drop-in substitute for FinalAttr.dll with the sample client Don includes in his official distribution, it is NOT intended as a replacement of any kind. If there are any new bugs, they are in my reverse-engineering; please look also for:
Don't bug Don. Bug me.


FindTypeEx
This is a modified version of the FindType sample that comes in the .NET SDK. This modification adds the ability to find all the types which derive (either directly or indirectly) from a specific base class or interface. Personally, I've found it a useful tool for exploring parts of the .NET Framework since it answers the question "what other parts of the Framework build on this piece of functionality?". I've included the C# source code (although 95% of it is the original Microsoft code with a few modifications & additions) as a demonstration of the neat things you can do with the reflection infrastructure.


DumpNS
This is a little command-line utility that helps you determine which namespaces are exported by which assemblies. This is useful for determining the correct physical DLLs to use with the "/r:" compiler switch. It can also be used to explore the assemblies in the %SystemRoot%\ComPlus\<buildno> directory, or to export a CSV file suitable for importing into Excel for cross-referencing. The utility includes source code in C#, but shouldn't be considered a 'sample' - it was hacked out in about 30 minutes, so is NOT something to emulate... :-)


CodeWright C# Lexer
This is a INI file fragment that adds C# syntax highlighting to CodeWright, a programmer's editor that I've spent waaaay too much time in during the 8 years I've been using it. IDE's are for wimps! Anyway, append this fragment to the end of your Lexer.Ini file in the CodeWright root directory (typically C:\CW32), go Tools|Customize|Language, add a new file type with a .CS extension, and choose the new C# Lexer option. Voila! C# Syntax Highlighting!


Comments, flames, consulting gigs, etc. to peter@razorsoft.com