Search code examples
c#fodyncrunch

NCrunch build fails, starting with fody >= 4.0.0 "Cannot convert transparent proxy to IInnerWeaver"


I have the following error while building my projects using NCrunch.

Fody: An unhandled exception occurred:
Exception:
Der transparente Proxy kann nicht in den Typ "IInnerWeaver" umgewandelt werden.
Type:
System.InvalidCastException
StackTrace:
   bei Processor.ExecuteInOwnAssemblyLoadContext()
   bei Processor.Inner()
   bei Processor.Execute()
Source:
Fody
TargetSite:
Void ExecuteInOwnAssemblyLoadContext()

It took me a while to determin howto reproduce the error:

Create a new c# library (net472) and install the nuget package NullGuard.Fody (1.8.7) which has a dependency to Fody (>= 3.3.5). Do not use packages.conf, but the new PackageReference format. Add FodyWeavers.xml.

Activate NCrunch (3.26.0.4 in Visual Studio 2019) using these settings:

  • Allow parallel execution
  • Run all tests automatically
  • Do not ignore tests by default

Both, Visual Studio and NCrunch can sucessfully build the project.

Install Fody (4.0.0), now, NCrunch cannot build any more, but Visual Studio still can.

Is this a fody/ncrunch bug, or do I miss something?


Solution

  • This should be fixed in version 5.0.5 of Fody https://github.com/Fody/Fody/milestone/109