24 October 2011

Moles Error Says I Haven't Instrumented a Type. What Does That Mean?

There are three possible causes for instrumentation exceptions:

Using Declarations and Assembly Attributes
You must ensure a MoledType assembly attribute is present, for the type specified by the exception.  For example:

[assemblyMoledType(typeof(System.IO.File))]

Refer to the How Do I Make My Test Use Moles post, for more details.


Mode of Execution
If you are certain you have included all of the required using declarations and assembly attributes, examine your method of execution.  Pex and Moles tests require special instructions to be sent to the compiler, to properly route calls through the Moles assembly.  Third party test execution utilities, such as CodeRush, do not provide this supplemental information.  A missing instrumentation exception will be thrown, when Pex and Moles tests are executed by CodeRush.


Unsupported Test Framework
Pex and Moles support both the Visual Studio and NUnit Test Frameworks.  Other frameworks are not supported.

No comments:

Post a Comment

Please provide details, when posting technical comments. If you find an error in sample code or have found bad information/misinformation in a post, please e-mail me details, so I can make corrections as quickly as possible.