Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Using System.Xml in .NET Core 2 gives FileNotFoundException for System.Collections.NonGeneric
thijstijsma
#1 Posted : Saturday, October 07, 2017 8:31:41 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/3/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 2 time(s) in 2 post(s)
I have a very simple test project with only one class as of now.
It's a .NET Core 2.0 library project.

I want to load an XmlSchema to pass to the class under test.

I get the following exception in XUnit, but was able to fix it by adding the NuGet package for "System.Collections.NonGeneric" in my test project.
The console application works fine without, is this something that needs to be added to NCrunch?

Kind regards,

Thijs Tijsma

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.Xml.Schema.XmlSchema..ctor()
at System.Xml.Schema.Parser.StartParsing(XmlReader reader, String targetNamespace)
at System.Xml.Schema.Parser.Parse(XmlReader reader, String targetNamespace)
at System.Xml.Schema.XmlSchema.Read(XmlReader reader, ValidationEventHandler validationEventHandler)
at System.Xml.Schema.XmlSchema.Read(Stream stream, ValidationEventHandler validationEventHandler)
Remco
#2 Posted : Saturday, October 07, 2017 11:31:50 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,873

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Hi, thanks for sharing this problem.

As long as this NuGet package has been added to the test project, there shouldn't be a resolution problem here for NCrunch.

Are you able to share this code with me? The assembly resolution system under .NET Core is so complex that it is unfortunately impossible to analyse these sorts of problems without a way to reproduce them.

You can submit code via the contact form.
thijstijsma
#3 Posted : Saturday, October 07, 2017 11:41:15 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/3/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 2 time(s) in 2 post(s)
I created and uploaded an example .NET Core project with xUnit.
Remco
#4 Posted : Saturday, October 07, 2017 11:56:18 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,873

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
That's great! Thanks for sending that through. I'll take a look and will get back to you soon.
thijstijsma
#5 Posted : Saturday, October 07, 2017 11:57:24 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/3/2017(UTC)
Posts: 6
Location: Netherlands

Was thanked: 2 time(s) in 2 post(s)
Just to let you know I'm not in a hurry to get this fixed since I have a workaround. I mean it's probably weekend for you too!
1 user thanked thijstijsma for this useful post.
Remco on 10/7/2017(UTC)
Remco
#6 Posted : Monday, October 09, 2017 12:50:28 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,873

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Right, so this one doesn't look like it'll be easy to fix.

This is being caused by binding information crossing over from NCrunch's .NET Core 1.0 and 1.1 assemblies over into the .NET Core 2.0 environment. MS changed the dependency handling between 1.1 and 2.0.

This means that as soon as someone uses an assembly that is referenced by one of NCrunch's .NET Core assemblies but isn't directly declared as a Nuget package, there will be a resolution issue.

When you see this, the workaround for this is to just introduce a Nuget package reference for the assembly you need.

I'm looking at removing support for .NET Core 1.0 and 1.1, since trying to maintain these versions is proving to be very complex and it's causing problems under 2.0.
Users browsing this topic
Guest (3)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.035 seconds.