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

Notification

Icon
Error

dotnetcore and NUnit 3.6.0
GreenMoose
#1 Posted : Monday, February 13, 2017 3:05:47 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
v3.3.0.6

Hi I know the support is not fully implemented but I noticed it works so nice for xunit/MSTest I thought there is a chance on getting it to work with NUnit as well?

What I did in latest VS2017 RC.4+26206 was:
1) create a new dotnetcore console project
2) Install package NUnit and NUnitLite 3.6.0
3) In Program.cs use below code (taken from https://github.com/nunit...s/wiki/NUnitLite-Runner ):
Code:

    class Program
    {
        static void Main(string[] args)
        {
            new AutoRun(Assembly.GetEntryAssembly()).Execute(args);
            //Console.WriteLine("Hello World!");
        }
    }

4) Add a TestFixture] class with a test.
5) Build in vstudio
6) run dll via dotnet <consoleApp>.dll

This works fine and my test is executed.

NCrunch however cannot build when I add the NUnit dependency (NUnitLite works fine) due to error below
Code:

NCrunch: This project was built on server '(local)'
NCrunch: The tests in this project were discovered on server '(local)'

NCrunch: This project was built on server '(local)'
NCrunch: The tests in this project were discovered on server '(local)'

An error occurred while analysing this project after it was built: System.ArgumentException:
A BadImageFormatException has been thrown while parsing the signature. This is likely due to 
lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided
 and contain enough context. ---> System.BadImageFormatException: Could not load file or 
 assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
 or one of its dependencies. Reference assemblies should not be loaded for execution.  They can
 only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058) --->
 System.BadImageFormatException: Could not load file or assembly 
 'file:///C:\Users\myUser\.nuget\packages\system.runtime\4.1.0\ref\netstandard1.5\System.Runtime.dll' 
 or one of its dependencies. Reference assemblies should not be loaded for execution.  They can only 
 be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058) ---> 



Is there something I can do about it?

Thanks.
Remco
#2 Posted : Monday, February 13, 2017 11:06:14 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1255 time(s) in 1168 post(s)
Hi, thanks for posting.

It's interesting that you have managed to get NCrunch working with MSTest/Xunit under v3.3. Because v3.3 doesn't yet have a runtime environment targeted towards .NET Core, I expect your mileage here will be very limited.

This looks like a .NET Core runtime exception, so I'm not sure if this is actually being caused by the build system. Perhaps it is a test discovery problem.

Unfortunately, I won't be able to tell more about the problem without attempting to reproduce it and analysing it in more detail. Because none of this is technically supported yet, these sorts of problems are to be expected. To avoid trying to tackle them piece by piece through support issues (which are very inefficient), I would instead prefer to continue with the .NET Core integration in the v3.4 release and ask for another 2-3 weeks to finish it first :)
GreenMoose
#3 Posted : Tuesday, February 14, 2017 7:29:50 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
Ok thanks, I understand. Looking forward the upcoming release then, trying to do TDD without NCrunch is extremely frustrating :)
(I even in desperation tried other tools but I had to give up that and resort to dotnet test command line runner in order to actually see any log output, feels like I have jumped in a time machine going back in time...)
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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download