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

Notification

Icon
Error

.Net Core 3.1 with WPF classes fail
jotto
#1 Posted : Wednesday, December 18, 2019 11:25:38 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/12/2013(UTC)
Posts: 13
Location: Norway

Was thanked: 5 time(s) in 5 post(s)
I have recently converted a project from .Net Framework 4.8 to .Net Core 3.1. The tested classes are using BitmapSource from WPF.

When I try to run these tests, I'm getting the following exception:

System.IO.FileNotFoundException : Could not load file or assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

It seems like NCrunch doesn't resolve the WPF dependency somehow.

The test project file looks like this:

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
...
<UseWPF>true</UseWPF>
</PropertyGroup>


Is this an NCrunch bug, or is there something I haven't configured properly?
Hunter-d-_-b
#2 Posted : Wednesday, December 18, 2019 4:11:53 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/18/2019(UTC)
Posts: 4
Location: United Kingdom

I'm not an expert but I had a similar issue recently with my solution.

In NCrunch
Go to: Configuration > Build Settings > Copy referenced assemblies to workspace = True

Let me know if it worked for you :)
Remco
#3 Posted : Wednesday, December 18, 2019 11:29:22 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
It's possible that this is a v4.2 regression - https://forum.ncrunch.net/yaf_postst2892_Could-not-load-file-or-assembly-after-4-2-0-7-update.aspx.

We're investigating this. I recommend trying the 'Copy referenced assemblies to workspace' setting (as suggested above), or rolling back to v4.1 to see if that fixes it.
jotto
#4 Posted : Thursday, December 19, 2019 8:20:08 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/12/2013(UTC)
Posts: 13
Location: Norway

Was thanked: 5 time(s) in 5 post(s)
Thanks for following up guys. Unfortunately I'm getting the same error with "Copy referenced assemblies to workspace".
Remco
#5 Posted : Thursday, December 19, 2019 12:10:03 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
jotto;14242 wrote:
Thanks for following up guys. Unfortunately I'm getting the same error with "Copy referenced assemblies to workspace".


Thanks for confirming this. Right now I believe it to be caused by this problem: https://forum.ncrunch.net/yaf_postst2892_Could-not-load-file-or-assembly-after-4-2-0-7-update.aspx

I recommend following the above thread for updates on the issue. Sadly, it's a tough one that might take us a while to crack. If you have the option, I recommend keeping your setup on an older toolset a little longer so you can still use NCrunch until we can fix the problem.
michaelkroes
#6 Posted : Friday, December 20, 2019 8:39:18 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
jotto
#7 Posted : Saturday, December 21, 2019 9:33:52 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/12/2013(UTC)
Posts: 13
Location: Norway

Was thanked: 5 time(s) in 5 post(s)
It still fails. Fortunately it's easy to reproduce with a test :-)

using System.Windows.Media;
using System.Windows.Media.Imaging;
using NUnit.Framework;

namespace MyNamespace
{
[TestFixture]
public class FailingTestClass
{
[Test]
public void FailingTest()
{
var bitmapSource =
BitmapSource.Create(10, 10, 96, 96, PixelFormats.Bgra32, null, new byte[10 * 10 * 4], 10 * 4);
}
}
}

1 user thanked jotto for this useful post.
michaelkroes on 12/21/2019(UTC)
michaelkroes
#8 Posted : Saturday, December 21, 2019 1:00:44 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
Thanks!

I've got it reproduced and I will get back to you.
michaelkroes
#9 Posted : Sunday, December 22, 2019 11:47:24 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
jotto
#10 Posted : Sunday, December 22, 2019 12:02:46 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/12/2013(UTC)
Posts: 13
Location: Norway

Was thanked: 5 time(s) in 5 post(s)
Do you guys never take a break during weekends? :-D

Thanks -- it works now!
1 user thanked jotto for this useful post.
michaelkroes on 12/22/2019(UTC)
michaelkroes
#11 Posted : Sunday, December 22, 2019 2:33:33 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
Thanks for the quick confirmation!
Users browsing this topic
Guest
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.071 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download