Thanks Craig for pointing out this excellent tool:
The Windows Application Verifier (AppVerifier) examines executable programs for common application quality issues. Running this tool on an application aids a tester in detecting issues dealing with stability, security, and compatibility. The AppVerifier works by monitoring an application’s use of the operating system, i.e. the file system, registry, memory, and APIs, while the application is being run. Once issues are discovered through the AppVerifier, the tool guides developers on how to fix these issues at the source code level.
I’m surprised this is on the XP site and not a standard part of the .NET SDK.