Nunit测试无法使用.Net Core C#显示以下异常

时间:2017-11-02 11:03:08

标签: c# .net .net-core nunit

Nunit测试不使用.net核心项目。 2017.11.02 08:56:04.998 ERROR转换失败:从事件状态转换。原因:System.InvalidOperationException:所选测试缺少测试用例。发现成功了吗? at Appccelerate.StateMachine.Machine.States.State 2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext 2 context)的Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument)中的JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo()

--- 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)
     at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)
”
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)
     at Appccelerate.StateMachine.Machine.StateMachine`2.OnExceptionThrown(ITransitionContext`2 context, Exception exception)
     at Appccelerate.StateMachine.Machine.Contexts.TransitionContext`2.OnExceptionThrown(Exception exception)
     at Appccelerate.StateMachine.Machine.States.State`2.HandleException(Exception exception, ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.HandleEntryActionException(ITransitionContext`2 context, Exception exception)
     at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryActions(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.Entry(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.EnterShallow(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.EnterHistoryNone(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.EnterByHistory(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.Transitions.Transition`2.Fire(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.Fire(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.StateMachine`2.Fire(TEvent eventId, Object eventArgument)
     at Appccelerate.StateMachine.PassiveStateMachine`2.ProcessQueuedEvents()
     at Appccelerate.StateMachine.PassiveStateMachine`2.Execute()
     at Appccelerate.StateMachine.PassiveStateMachine`2.Fire(TEvent eventId, Object eventArgument)
     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.11.02 08:56:05.078   ERROR Run: eeee49e6-523e-4d70-a7c2-24fd50ec002a - Faulted
2017.11.02 08:56:05.078   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)
   at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)
   --- 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)
   at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)<---

2 个答案:

答案 0 :(得分:1)

安装Microsoft.NET.Test.Sdk后,其工作正常...... !! 参考:http://www.alteridem.net/2017/05/04/test-net-core-nunit-vs2017/

答案 1 :(得分:0)

就我而言,我手动启用了完整的调试符号,这些符号将此部分添加到csproj文件中:

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
  <DebugType>full</DebugType>
  <DebugSymbols>true</DebugSymbols>
</PropertyGroup>

当我删除此部分时,一切正常。