Resharper Ultimate 2017.1.3 fails to execute .NET Core 2 xUnit tests in Visual Studio 2017.3


I created a xUnit test project targeting .NET Core 2.

I'm running:

  • Visual Studio 2017.3 (latest)
  • Resharper Ultimate 2017.1.3 (latest)
  • .NET Core 2 (latest)
  • Windows 10 Professional (latest)

Project dependencies:

NuGet:

  • Microsoft.NET.Test.Sdk (15.3.0)
  • Microsoft.TestPlatform.TestHost (15.3.0)
  • xunit (2.2.0)
  • xunit.runner.visualstudio (2.2.0)

SDK:

  • Microsoft.NETCore.App (2.0.0)

Test file: Class1.cs

using Xunit;

namespace Tests
{
    public class Class1
    {
        [Fact]
        public void Tests()
        {
            Assert.Equal(1, 1);
        }
    }
}

Test Explorer picks up the test and runs it successfully.


Resharper picks up the test, but fails to execute the test with "Inconclusive: Test not run"

Output > Resharper Tests:

[2017/08/15 4:56:24 PM] Exploration started for <Tests,.NETCoreApp,Version=v2.0>
[2017/08/15 4:56:24 PM] Exploration started for <Tests,.NETCoreApp,Version=v2.0> using <xUnit.net,XunitDotNetVsTestArtefactExplorer> on thread <1:>
[2017/08/15 4:56:24 PM] Exploration started for <Tests,.NETCoreApp,Version=v2.0> using <MSTest,MsTestDotNetVsTestArtefactExplorer> on thread <1:>
[2017/08/15 4:56:24 PM] Exploration skipped for <Tests,MSTest,.NETCoreApp,Version=v2.0>: project not supported by provider
[2017/08/15 4:56:24 PM] Exploration by <MSTest> completed for <Tests, .NETCoreApp,Version=v2.0>
[2017/08/15 4:56:24 PM] Exploration by <xUnit.net> failed for <Tests,.NETCoreApp,Version=v2.0> dotnet exited unexpectedly with the code (0) Output stream: Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02 Copyright (c) Microsoft Corporation. All rights reserved. Error stream:

--- EXCEPTION #1/2 [ProcessExitedUnexpectedlyException]
Message = “
  dotnet exited unexpectedly with the code (0)
  Output stream: Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02
  Copyright (c) Microsoft Corporation.  All rights reserved.
  Error stream:

ExceptionPath = Root.InnerException
ClassName = JetBrains.ReSharper.UnitTestFramework.DotNetCore.Exceptions.ProcessExitedUnexpectedlyException
HResult = COR_E_EXCEPTION=80131500

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “
  Exploration by <xUnit.net> failed for <Tests,.NETCoreApp,Version=v2.0> dotnet exited unexpectedly with the code (0)
  Output stream: Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02
  Copyright (c) Microsoft Corporation.  All rights reserved.
  Error stream:

ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.ReSharper.UnitTestFramework.Exploration.UnitTestArtefactExplorationRunner.<>c__DisplayClassd.<ExploreProject>b__8(Task t)
     at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
     at System.Threading.Tasks.Task.Execute()
     at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
     at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
     at System.Threading.Tasks.TaskScheduler.TryExecuteTask(Task task)
     at JetBrains.Application.Threading.Tasks.Scheduler.JetScheduler.ExecuteTask(Task task)
     at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.EnqueueNextTask()
     at JetBrains.Application.Threading.Tasks.Scheduler.JetSchedulerThread.ThreadPoolProc()
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.ThreadHelper.ThreadStart()


[2017/08/15 4:56:24 PM] Exploration by <xUnit.net> completed for <Tests, .NETCoreApp,Version=v2.0>
[2017/08/15 4:56:24 PM] Exploration completed for <Tests,.NETCoreApp,Version=v2.0>

I suspect the output from the latest Test Execution Command Line Tool changed.

Any suggestions?

31 comments
Comment actions Permalink

Hello John!

 

Please check that your test project has references to the following nuget packages required to run tests:

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />

Thank you.

3
Comment actions Permalink

Hello Hauke!

 

Sorry didn't mean anything like that.

It you're experiencing this problem with NUnit test framework please check that the following packages are installed as descibed in NUnit documentation 

<ItemGroup>
  <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
  <PackageReference Include="NUnit" Version="3.9.0" />
  <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
</ItemGroup>

Hope it helps.

Thank you

2
Comment actions Permalink

Same problem here with VS 2017 15.4.1 and R# 2017.2.2 and NUnit 3.8.1

1
Comment actions Permalink

Hi Angelina,

with those packages added, the test is actually run.

But, as I understand the linked nunit documentation, it's all about running nunit tests in visual studio, i.e. visual studio's test explorer. I had no idea that the same applies when using resharper's test runner, and even more so as resharper detects the tests just fine, but fails to execute them (whereas visual studio outright ignores the tests) without these packages.

1
Comment actions Permalink

Hello!

 

Thank you for contacting us.

ReSharper 2017.1.3 does not support .NET Core 2.0. Please try installing R# 2017.2 EAP https://www.jetbrains.com/resharper/eap/.

Thank you.

0
Comment actions Permalink

I am having the same issue except it doesn't detect the tests unless I open the specific .cs file for the test.

0
Comment actions Permalink

Thank you, the EAP version works.

0
Comment actions Permalink

Will R# 2017.2 be released soon? I would like to have Resharper work for my .NET Core 2.0 project.

0
Comment actions Permalink

I am still seeing this with with XUnit and the latest 17.2.1 that I installed today. Any ideas?

 

Here is what I am seeing:

 

2017.09.21 10:04:26.362 ERROR Transition failed: Transition from state <HandShake> on event <remote::.ProtocolVersion>. Cause: System.InvalidOperationException: Test-cases are missing for the selected tests. Did discovery succeed? at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo() at Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\ActionHolders\ArgumentLessActionHolder.cs:line 37 at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 340

--- EXCEPTION #1/1 [LoggerException]
Message = “
Transition failed: Transition from state <HandShake> on event <remote::.ProtocolVersion>.
Cause: System.InvalidOperationException: Test-cases are missing for the selected tests. Did discovery succeed?
at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo()
at Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\ActionHolders\ArgumentLessActionHolder.cs:line 37
at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 340

ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestProtocol.<.ctor>b__e(Object sender, TransitionExceptionEventArgs`2 args)
at Appccelerate.StateMachine.Machine.StateMachine`2.RaiseEvent[T](EventHandler`1 eventHandler, T arguments, ITransitionContext`2 context, Boolean raiseEventOnException) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\StateMachine.cs:line 404
at Appccelerate.StateMachine.Machine.StateMachine`2.OnExceptionThrown(ITransitionContext`2 context, Exception exception) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\StateMachine.cs:line 260
at Appccelerate.StateMachine.Machine.Contexts.TransitionContext`2.OnExceptionThrown(Exception exception) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\Contexts\TransitionContext.cs:line 74
at Appccelerate.StateMachine.Machine.States.State`2.HandleException(Exception exception, ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 307
at Appccelerate.StateMachine.Machine.States.State`2.HandleEntryActionException(ITransitionContext`2 context, Exception exception) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 357
at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 345
at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryActions(ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 330
at Appccelerate.StateMachine.Machine.States.State`2.Entry(ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 247
at Appccelerate.StateMachine.Machine.States.State`2.EnterShallow(ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 285
at Appccelerate.StateMachine.Machine.States.State`2.EnterHistoryNone(ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 429
at Appccelerate.StateMachine.Machine.States.State`2.EnterByHistory(ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 263
at Appccelerate.StateMachine.Machine.Transitions.Transition`2.Fire(ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\Transitions\Transition.cs:line 87
at Appccelerate.StateMachine.Machine.States.State`2.Fire(ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 222
at Appccelerate.StateMachine.Machine.StateMachine`2.Fire(TEvent eventId, Object eventArgument) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\StateMachine.cs:line 230
at Appccelerate.StateMachine.PassiveStateMachine`2.ProcessQueuedEvents() in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\PassiveStateMachine.cs:line 339
at Appccelerate.StateMachine.PassiveStateMachine`2.Execute() in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\PassiveStateMachine.cs:line 324
at Appccelerate.StateMachine.PassiveStateMachine`2.Fire(TEvent eventId, Object eventArgument) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\PassiveStateMachine.cs:line 177
at JetBrains.ReSharper.UnitTestFramework.DotNetCore.Channel.DotNetCoreMessageListener.<>c__DisplayClass2`1.<RegisterMessage>b__1(JToken payload)
at JetBrains.ReSharper.UnitTestFramework.DotNetCore.Channel.DotNetCoreMessageListener.OnMessage(String rawMessage)
at JetBrains.ReSharper.UnitTestFramework.DotNetCore.Channel.DotNetCoreRemoteChannel.ReaderThreadProc()
at JetBrains.ReSharper.TaskRunnerFramework.RemoteChannelBase.<Start>b__0(Object _)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

2017.09.21 10:04:26.410 ERROR Run: 07b5ddab-08cf-435a-92f4-9817f92ac252 - Faulted
2017.09.21 10:04:26.411 ERROR System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Test-cases are missing for the selected tests. Did discovery succeed?
at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo()
at Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\ActionHolders\ArgumentLessActionHolder.cs:line 37
at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 340
--- End of inner exception stack trace ---
at JetBrains.ReSharper.UnitTestFramework.Launch.Stages.RunTestsStage.<>c__DisplayClassc.<StartSingleRun>b__8()
---> (Inner Exception #0) System.InvalidOperationException: Test-cases are missing for the selected tests. Did discovery succeed?
at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo()
at Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\ActionHolders\ArgumentLessActionHolder.cs:line 37
at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\Machine\States\State.cs:line 340<---

 

0
Comment actions Permalink

Thanks Angelina,

my xUnit tests are now working.

0
Comment actions Permalink

Hello Hauke!

 

Thank you for the feedback.

Is there any chance you could provide some sample solution introducing the issue?

Thank you.

0
Comment actions Permalink

Hi Angelina,

a trivial project works to reproduce this: create a new net core 2.0 app, add the nunit package, put a [TestFixture] attribute in front of class1, add an empty void method and add a [Test] attribute to the method. click on the green circle, click on run tests, nothing happens.

 

0
Comment actions Permalink

I'm having same issue, and the target framework is netcoreapp1.0 not 2

0
Comment actions Permalink

Hello guys!

 

Sorry for late reply.

Could you please try the latest ReSharper 2017.3 EAP build - https://www.jetbrains.com/resharper/eap/ and check if the problem persisits?

Thank you.

0
Comment actions Permalink

I have been experiencing the same issue as John with 2017.2.2: using .NET Core 2.0 and Nunit 3.9.0, rather than xUnit. 

I have installed the 2017.3 EAP as instructed and the unit test explorer is no longer able to discover the tests, let alone fail to execute them.

 

0
Comment actions Permalink

Hello J Coldridge!

 

Thank you for the feedback.

Could you please provide the list of installed packages in the solution?

Thank you.

0
Comment actions Permalink

I managed to solve this by commenting some package references in my test csproj

  <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
    <PackageReference Include="System.Console" Version="$(CoreFxVersion)" />
    <PackageReference Include="System.Diagnostics.Debug" Version="$(CoreFxVersion)" />
    <PackageReference Include="System.Linq.Expressions" Version="$(CoreFxVersion)" />
    <PackageReference Include="System.Reflection.Extensions" Version="$(CoreFxVersion)" />
    <PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
    <PackageReference Include="System.Threading.Tasks.Parallel" Version="$(CoreFxVersion)" />
    <PackageReference Include="Microsoft.CSharp" Version="$(CoreFxVersion)" />
  </ItemGroup>

0
Comment actions Permalink

Same Issue with:

Visual Studio 2017 - 15.5.2

R# - 2017.3.1

using .NET Core 2.0

0
Comment actions Permalink

Hello David!

 

Thank you for the feedback

What test framework is used in your project?

Is there any chance you could provide demo solution for us? You can do it randomly using 'Submit a request' form. Also we can sign NDA if needed.

Thank you.

0
Comment actions Permalink

Hi Angelina,

I'm not sure whether you're making fun of us or trying to look retarded. The demo solution - as described above - is literally one premade class with one empty method:

[......... class1.cs ..............]

using NUnit.Framework;

namespace ReallySimpleProject
{
    [TestFixture]
    public class Class1
    {
        [Test]
        public void Test()
        {
            Assert.Fail( "yuck" );
        }
    }
}

[......... class1.cs ..............]

 

[......... ReallySimpleProject.csproj ..............]

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="NUnit" Version="3.9.0" />
  </ItemGroup>

</Project>
[......... ReallySimpleProject.csproj ..............]

 

0
Comment actions Permalink

Hello Hauke!

 

Thank you for the reply.

The specified packages are needed for .Net Core no matter what test runner is used.

Anyway as far as R# is VS extenstion it's a good practice to try to run tests with both VS and R#. If tests are not run with neither VS or R# it could be some configuration issue.

Thank you.

0
Comment actions Permalink

FYI: I see the same issue in Visual Studio 2017.5.3 Resharper ultimate 2017.3.1

For Test project using <TargetFramework>net461</TargetFramework>

and XUnit

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />

And also references 

<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" />

Removing the last two references makes the problem go away. But We want them to support both visual studios test runner and resharper testrunner.

0
Comment actions Permalink

I had this same issue when I just had VS 2017 15.5.6 and Resharper 2017.3.1

Updating to VS 2017 preview and the Resharper 2017.3.2.EAP also didn't fix it.

 

After loading resharper and VS with verbose logging using: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe" /ReSharper.LogFile C:\log\resharper_log.txt /ReSharper.LogLevel verbose

 

The error shown in the test runner was there: ERROR System.NullReferenceException: Object reference not set to an instance of an object.
at JetBrains.ReSharper.UnitTestProvider.nUnit.v30.NUnitServiceProvider.GetRunStrategy(IUnitTestElement element)

 

But more importantly was this error

--- EXCEPTION #2/2 [LoggerException]
Message = "Passed version string '2.1.100-preview-007326' doesn't look to be a valid .net core sdk version"

 

Once I removed the preview version release of the SDK (which I'm not sure why the non-preview version of VS 2017 installed) it worked fine. those SDK versions were here: `C:\Program Files\dotnet\sdk`

0
Comment actions Permalink

Hello Nick!

 

Thank you for the feedback.

Here's correspondent issue reported - https://youtrack.jetbrains.com/issue/RSRP-468169.

Please feel free to comment or vote for it.

Thank you.

0
Comment actions Permalink

Hello Nick!

 

We've released ReSharper 2017.3.2 which contains fix of this issue - https://www.jetbrains.com/resharper/download/.

Please let us know if it helps.

Thank you.

0
Comment actions Permalink

Hi,

Long time fan here, we just bumped our code base to use this new test framework and even though we are using the update you linked Angelina it is still not working. Please escalate this!

Thanks!

0
Comment actions Permalink

Hello Johanstenberg92!

 

Thank you for the feedback.

Could you please provide some more details on the problem:

  • what's actually is not working? Is there any error that you're getting?
  • what test framework do you use NUnit/XUnit, what version?
  • what type of project do you use .NET Framework, Core, what version?

Also please start VS with the following command: 'devenv /ReSharper.LogFile C:\resharper_log.txt /ReSharper.LogLevel Verbose', reproduce the problem and send log file to us.

You can attach it to support request via 'Submit a request' form along with other requested information.

Thanks in advnace!

Thank you.

0
Comment actions Permalink

Sorry, I was miss-reading thread title. We can't get it working for this test framework: https://blogs.msdn.microsoft.com/devops/2016/06/17/taking-the-mstest-framework-forward-with-mstest-v2/ thanks.

0
Comment actions Permalink

Thank you for the reply, Johanstenberg92.

 

What about other information? Is there chance you could provide it?

Thank you.

0

Please sign in to leave a comment.