Daily Usage Issues

Core 2.0 test project not able to read deps

Started by PEtter on 4,108 views

In the start of my test. I have the following

var path = Process.GetCurrentProcess().MainModule.FileName;



System.IO.FileNotFoundException : Could not load file or assembly 'System.Collections.NonGeneric, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
   at System.Diagnostics.NtProcessManager.GetModules
   at System.Diagnostics.NtProcessManager.GetFirstModule(Int32 processId)
   at System.Diagnostics.Process.get_MainModule()
   at test.Class1.ConnectToDb() in C:\projects\blitzdb\test\Class1.cs:line 16


Seems nCrunch does not restore nuget packages when it starts to run?

NCrunch is reliant on Visual Studio restoring Nuget packages for it. In the early stages of integration with .NET Core, NCrunch tried to do this itself, but it only caused chaos.

If you're seeing this consistently after resetting the engine, check to make sure you have a Nuget dependency on System.Collections.NonGeneric from your test project. NCrunch does have a known issue where it has difficulty negotiating some Nuget dependencies that are not referenced directly by the test project.
Seems everything that is not directly referenced by the test project is failing.. hmmmm

The main ref here is the SDK Microsoft.NetCoreApp

Edited

Referencing the System.ComponentModel.TypeConverters directly solved the issue for now..
If this is the same as the known problem, there will be a limited number of Nuget references affected by this.

The root of the issue is that NCrunch still supports .NET Core 1.1, so all of its .NET Core libraries are compiled to this version of the framework. Because the referencing system is different between these two version of .NET Core, this wrecks havoc with the generation of .deps. Introducing Nuget references from the test project for any malfunctioning dependencies effectively resolves the issue.

Post a reply

Log in to reply.