Managed code is program code that runs as part of the Common Language Runtime in a .NET environment. This gives such code access to automatic memory management, helps to ensure some degree of platform neutrality and enables simplified cross-language integration. In different terms, managed code is code that conforms to the .NET Framework, runs inside the .NET environment, and can use .NET managed facilities. If you want to learn more about why using managed code for .NET development is so important, check out the article at DataDirect entitled The Importance of Using Managed Code in .NET Development (and if you're really gung-ho, follow the numerous links available in that article's "Advantages of Managed Code" links section).
All this begs the question, "How can developers be sure that their code conforms to the .NET Framework and so forth?" That's where FxCop comes into play.
You'll find this excellent (and free) tool online at Microsoft's GotDotNet.com site on the FxCop Team Page. Implementations for both Versions 1.1 and 2.0 of the .NET Framework are available for there, and well worth checking out. Both GUI and command line versions of the tool are included among the executables that will be installed for either one. You'll also find a useful Readme file there and a somewhat dated but still valuable help file there as well (FxCop.chm is available only for version 1.32.0, which corresponds to the .NET Framework 1.1 version of FxCop itself). You can also find pointers to documentation and sample files there as well, to help you understand how to make use of the tool.
What the tool does is to inspect managed code assemblies and apply various types of tests—including reflection, MSIL parsing, and callgraph analysis—to inspect them for over 200 defects that might occur in one or more of the following areas:
There's even an active FxCop Managed Code Analysis Forum on MSDN where interested (and actual) users can turn for information or help from FxCop developers, experts, and other experienced users. The FxCop blog appears to be an extremely rich body of information and is even cited repeated for answers in the FxCop FAQ itself.
Those who build managed code assemblies for .NET will find FxCop worth downloading, learning and using. Be sure to check it out.
Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security. Send comments, queries, or suggested topics or tools for review to Ed at firstname.lastname@example.org.
This was first published in April 2006