If you are new to Pex & moles like me, you may encounter this exception while mocking any property. I have mocked one of our Dictionary and received this exception. The cause is missing one attribute on the test method.
Resolution:
If you are in Visual Studio Unit test and using Pex & Moles, then use the attribute HostType for the method.
[TestMethod]
[HostType(“Moles”)]public void UnloadAfterDequeue04()
{
……………………………………………
}