Given the interface
public interface IProxy
{
Task<IsAlive> IsAlive();
}
And this code in a [TestMethod]:
var fakeProxy = new Mock<IProxy>();
fakeProxy.Setup(x => x.IsAlive()).Throws(new Exception());
This exception happens:
System.NotImplementedException: 26
at Mono.Cecil.SignatureReader.GetPrimitiveType(ElementType etype)
at Mono.Cecil.SignatureReader.ReadTypeSignature(ElementType etype)
at Mono.Cecil.SignatureReader.ReadGenericInstanceSignature(IGenericParameterProvider provider, IGenericInstance instance)
at Mono.Cecil.MetadataReader.ReadMethodSpecSignature(UInt32 signature, MethodReference method)
at Mono.Cecil.MetadataReader.GetMethodSpecification(UInt32 rid)
at Mono.Cecil.MetadataReader.LookupToken(MetadataToken token)
at Mono.Cecil.Cil.CodeReader.ReadOperand(Instruction instruction)
at Mono.Cecil.Cil.CodeReader.ReadCode()
at Mono.Cecil.Cil.CodeReader.ReadFatMethod()
at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
at Mono.Cecil.MethodDefinition.<get_Body>b__2(MethodDefinition method, MetadataReader reader)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.MethodDefinition.get_Body()
at #=qvR9ZGzr8CCovl$1ZWXK_eLSjLaTI$uMOxs5cPgahDsVPhHLAiMkRuYX2b7PCfOrQccB2uJ8zwPMfRMvpt34vXA==.#=qAEZbinkhejjF4v9bhob4UkqEAL72x4cJX3Du$heNR7Q=(Collection`1 #=q7S0drwuwEUY3jUk9GvSG4Q==)
at #=qvR9ZGzr8CCovl$1ZWXK_eLSjLaTI$uMOxs5cPgahDsVPhHLAiMkRuYX2b7PCfOrQccB2uJ8zwPMfRMvpt34vXA==.#=qTBxJhN4WsTDxiWu4AKHFiR1KJ0rMIJZYEFmt8pH44gY=(IEnumerable`1 #=qq_2NgUCzmnANBGcs65uzqg==)
at #=qvR9ZGzr8CCovl$1ZWXK_eLSjLaTI$uMOxs5cPgahDsVPhHLAiMkRuYX2b7PCfOrQccB2uJ8zwPMfRMvpt34vXA==.#=qcM9x4PpSoSvdqeACaAo55E4F96lpuE_zPZZ$5hwKu$8=()
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.Instrument(ComponentSourceLineMap sourceLineMap, IDictionary`2 instrumentationDirectivesByCodeFileId, IDictionary`2 codeFileIDsByFilePath, Boolean proxyProcessIsActive, Int32 componentId, IInstrumentationFilter[] instrumentationFilters)
at nCrunch.Compiler.RemoteBuildRunner.#=qqZ$biBs7mvGRD42no0zcEfaWi4v$NuLBVy7NcKpqVcU=(ComponentBuildParameters #=q8_ZGEckiLbRsUjNXvAaKOg==, FilePath #=qkb_tmWgu4KtzCWen$hSPsMPrQ1mkbV0Q2nGsXkZrK6s=, BuildOutput #=qnXDAQpnfqAeJl0p31Gcd1w==, DirectoryPath[] #=qSofaDjiwWEBgv$s22DxHPsKSbp4hruna3jReeOLGOyg=, FilePath[] #=qfLDmMJzWXbDJK4KiH6tg6MwNo8hcfZSKZe0YwSutOdtYLr7gvxG6$V$9q044oc1x)
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)
Changing from Moq to FakeItEasy give the following:
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Apparently it was missing a reference to the project holding IsAlive.
Ncrunch 2.4.0.2
Thanks