Build/Test Issues

Wrong assembly version copied to _ncrunchreferences

Started by mc-clasoft on 4,643 views

Hi,

I've been using NCrunch quite a while in a project based on .NET 4.6.2 using MongoDB 2.4.4, compiled with Visual Studio 2017. After upgrading the project to .NET 4.7, NCrunch (3.20) started copying the wrong version of System.Runtime.InteropServices.RuntimeInformation.dll to _ncrunchreferences. Visual Studio shows the path "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net47\lib\System.Runtime.InteropServices.RuntimeInformation.dll", with version 4.0.2. The respective assemblybinding setting in the app.config redirects to 4.0.2. This works fine for the xunit console test-runner and the ReSharper runner, but when using NCrunch to run the tests, the MongoDB internals throw a FileNotFoundException for version 4.0.0. NCrunch apparently found 4.0.0, copied it to _ncrunchreferences, but MongoDB only seems to accept 4.0.2 (probably due to the redirect to 4.0.2 introduced by the upgrade to .NET 4.7). I guess that NCrunch uses the assembly from the System.Runtime.InteropServices.RuntimeInformation Nuget package, which is 4.0.0, even though Visual Studio shows a different path in the reference properties of that assembly.

Now I enabled "Copy referenced assemblies to workspace", which apparently solves the problem. But it seems very strange, and NCrunch explicitly warns about the performance implications of this setting. How can I force NCrunch to avoid the assembly from the Nuget package? I can't uninstall it, because it's a dependency of MongoDB. It just should be ignored, just like Visual Studio does.

Best regards,
Malte
Hi Malte,

Thanks for sharing this issue.

With VS15.8, MS introduced an assembly referencing redirection hack that affected some versions of .NET. This has caused a chain of issues for us, as it means that projects now need to be built with one version of assembly while referencing a different one at run time.

NCrunch v3.19/v3.20 introduced a fix in this area, but there still seems to be a scenario that it doesn't address. We've been desperately trying to get hold of a sample solution that can produce the problem for us so that we can fix it. Is there any chance you can isolate this in a sample that you can share with us? You can submit small code ZIPs through the NCrunch contact form.
I'm sorry for the time it's taken to come back to you on this issue. The MSBuild redirection hack that MS introduced with VS15.8 has given us tremendous problems with our build integration and it's taken a while to figure out how to fix everything. Would you be interested in trying the build below to see if this solves the problem for you?

NCrunch_Console_3.21.0.3.msi
NCrunch_Console_3.21.0.3.zip
NCrunch_GridNodeServer_3.21.0.3.msi
NCrunch_GridNodeServer_3.21.0.3.zip
NCrunch_LicenseServer_3.21.0.3.zip
NCrunch_VS2008_3.21.0.3.msi
NCrunch_VS2010_3.21.0.3.msi
NCrunch_VS2010_3.21.0.3.zip
NCrunch_VS2012_3.21.0.3.msi
NCrunch_VS2012_3.21.0.3.zip
NCrunch_VS2013_3.21.0.3.msi
NCrunch_VS2013_3.21.0.3.zip
NCrunch_VS2015_3.21.0.3.msi
NCrunch_VS2015_3.21.0.3.msi.7z
NCrunch_VS2015_3.21.0.3.zip
NCrunch_VS2017_3.21.0.3.msi
NCrunch_VS2017_3.21.0.3.msi.7z
NCrunch_VS2017_3.21.0.3.zip
Thanks Remco, this solved the problem.

Post a reply

Log in to reply.