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

Notification

Icon
Error

2 Pages<12
Tests utilising Microsoft.AspNet.TestHost fail in NCrunch
alastairs
#21 Posted : Monday, May 29, 2017 11:05:11 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 36
Location: Cambridge, UK

Thanks: 12 times
Was thanked: 2 time(s) in 2 post(s)
Ok, thanks Remco. I tried doing the step-by-step conversion this morning, and the repro project just kept working :) All of the test projects are targeting netcoreapp1.1. Looking at the simpler of the two real-world solutions, I see that the Web project is indeed present in the workspace directory for one of the failing tests. I also found an ncruncherror file, which contained the following text:
Code:
System.Exception: Could not resolve assembly: System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


I'm still waiting to hear back whether I can send through any of our code for you; a possible alternative could be a remote-debugging call via Skype or something?
ghelyar
#22 Posted : Tuesday, May 30, 2017 8:56:34 AM(UTC)
Rank: Member

Groups: Registered
Joined: 12/19/2016(UTC)
Posts: 12
Location: United Kingdom

Thanks: 3 times
Was thanked: 2 time(s) in 2 post(s)
This was working fine for me on ncrunch 3.6 with an asp.net core (.net framework) project and a .net framework class library unit test project running nunit.

Since upgrading to 3.8 it still works but I get the "The Microsoft.AspNetCore.TestHost package contains code that extracts dependency data from the .deps files of user projects in its environment. ..." warning.

I'm also suddenly getting the "NCrunch detected unusual behaviour around the resolution of referenced assemblies required by this project in its test environment. This can often be caused by usage of the 'Copy Referenced Assemblies To Workspace' setting, ..." warning, without having changed anything.

If this only affects .net core and not .net framework, although I'm not sure whether it does, can this behaviour/warning be disabled for .net framework?
Remco
#23 Posted : Wednesday, May 31, 2017 1:51:38 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 606 times
Was thanked: 697 time(s) in 667 post(s)
Thanks Alastair for your help in diagnosing this issue. When .NET Core generates these .deps files, it uses the name of the output assembly (dll) for each project, where it looks like NCrunch is using the project name (oops). Because your solution has projects with a different output assembly name to the project name, the .deps handling fails to work correctly. Changing the names of your projects to match the assembly names should get this working for you on v3.8 (if this is an option). I hope I should have a proper fix available for you on this later this week.

@ghelyar: Sorry, just to confirm your situation, are you using the Microsoft.AspNetCore.TestHost package under classic .NET and not .NET Core?
1 user thanked Remco for this useful post.
alastairs on 5/31/2017(UTC)
alastairs
#25 Posted : Wednesday, May 31, 2017 6:32:23 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 36
Location: Cambridge, UK

Thanks: 12 times
Was thanked: 2 time(s) in 2 post(s)
*facepalm* The one thing I didn't even think about! Good detective work, thanks Remco :-)
ghelyar
#24 Posted : Wednesday, May 31, 2017 7:00:21 AM(UTC)
Rank: Member

Groups: Registered
Joined: 12/19/2016(UTC)
Posts: 12
Location: United Kingdom

Thanks: 3 times
Was thanked: 2 time(s) in 2 post(s)
Remco;10487 wrote:
@ghelyar: Sorry, just to confirm your situation, are you using the Microsoft.AspNetCore.TestHost package under classic .NET and not .NET Core?


Yes, the project template in Visual Studio 2017 is "ASP.NET Core Web Application (.NET Framework)" and the unit test project is Class Library (.NET Framework) with NUnit and Microsoft.AspNetCore.TestHost via nuget.

I don't know if .net framework vs .net core is what's making a difference, but I never had any problems with it on ncrunch 3.6, and it still works fine despite the warnings on ncrunch 3.8.

I'm currently copying reference assemblies to output, which then shows a different warning, which I'm hiding, but this obviously has drawbacks if it isn't needed and it means I need to check the .v3.ncrunchproject file into source control, which I try to avoid if I can.
Remco
#26 Posted : Wednesday, May 31, 2017 12:56:55 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 606 times
Was thanked: 697 time(s) in 667 post(s)
Ok, it looks like there is a problem with the TestHost support in that it switches itself on for .NET Framework when it probably isn't needed. This will hurt NCrunch's build optimisation. Since you have the 'Copy referenced assemblies to workspace' setting turned on, it shouldn't make any difference in your case .. but it's good to know that this should perhaps be avoided under .NET Framework. I'll take an extra look before I put the fix up. Thanks for making me aware of it.
ghelyar
#27 Posted : Wednesday, May 31, 2017 1:33:50 PM(UTC)
Rank: Member

Groups: Registered
Joined: 12/19/2016(UTC)
Posts: 12
Location: United Kingdom

Thanks: 3 times
Was thanked: 2 time(s) in 2 post(s)
Remco;10490 wrote:
Since you have the 'Copy referenced assemblies to workspace' setting turned on, it shouldn't make any difference in your case ..

I have only turned it on because of the new behaviour/warning introduced in ncrunch 3.8. I did what it told me to do, and when it still gave me a (new) warning, I told it to shut up. Then I checked it in to source control so that other developers don't freak out that a bunch of projects are suddenly throwing warnings out left, right and centre.

Ideally, I would like to turn 'Copy referenced assemblies to workspace' off again.

As long as you're aware of the issue, I'll leave alone for now.

Thanks
Remco
#28 Posted : Wednesday, May 31, 2017 1:49:40 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 606 times
Was thanked: 697 time(s) in 667 post(s)
ghelyar;10491 wrote:
Remco;10490 wrote:
Since you have the 'Copy referenced assemblies to workspace' setting turned on, it shouldn't make any difference in your case ..

I have only turned it on because of the new behaviour/warning introduced in ncrunch 3.8. I did what it told me to do, and when it still gave me a (new) warning, I told it to shut up. Then I checked it in to source control so that other developers don't freak out that a bunch of projects are suddenly throwing warnings out left, right and centre.


Understood! Sorry, you definitely want this off then. That will require a codefix. I recommend you stick with v3.7 until I can get you a new build.
Remco
#29 Posted : Thursday, June 01, 2017 6:41:04 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 606 times
Was thanked: 697 time(s) in 667 post(s)
2 users thanked Remco for this useful post.
ghelyar on 6/1/2017(UTC), alastairs on 6/2/2017(UTC)
ghelyar
#30 Posted : Thursday, June 01, 2017 7:03:52 AM(UTC)
Rank: Member

Groups: Registered
Joined: 12/19/2016(UTC)
Posts: 12
Location: United Kingdom

Thanks: 3 times
Was thanked: 2 time(s) in 2 post(s)
Thanks. 3.9.0.1 works for me. I was able to remove the CopyReferencedAssembliesToWorkspace setting, CopyReferencedAssembliesToWorkspaceIsOn warning and AspNetTestHostCompatibility warning with the setup I described above (asp.net core (.net framework)) and all tests ran and passed successfully with no warnings in VS2017.
1 user thanked ghelyar for this useful post.
Remco on 6/1/2017(UTC)
alastairs
#31 Posted : Friday, June 02, 2017 10:27:53 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/13/2011(UTC)
Posts: 36
Location: Cambridge, UK

Thanks: 12 times
Was thanked: 2 time(s) in 2 post(s)
Remco, this build works like a charm, thank you so much.
1 user thanked alastairs for this useful post.
Remco on 6/2/2017(UTC)
Remco
#32 Posted : Friday, June 16, 2017 4:06:28 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 606 times
Was thanked: 697 time(s) in 667 post(s)
Remco
#33 Posted : Tuesday, July 18, 2017 1:19:42 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 606 times
Was thanked: 697 time(s) in 667 post(s)
NCrunch v3.10 has now been released.
Users browsing this topic
Guest (2)
2 Pages<12
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.083 seconds.