我正在使用Resharper Ultimate 2017.3.1

当我尝试调试单元测试时

[DataTestMethod]
[DataRow("bla", "blub")]
public void Test_When_Then() { ... }


然后测试停止调试,更改为状态inconclusive,并且在resharper测试资源管理器窗口中显示以下错误:


  2018.01.17 13:02:20.367错误过渡失败:事件发生时从状态过渡。原因:
  System.ArgumentException:应至少有一个测试
  测试运行。参数名称:测试--->
  System.ServiceModel.FaultException:应该至少有一个测试
  在测试运行中。参数名称:测试服务器堆栈跟踪:at
  System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime
  操作,ProxyRpc&rpc)位于
  System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,
  布尔型单向,ProxyOperationRuntime操作,Object [] ins,
  Object []超时,TimeSpan超时)在
  System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
  methodCall,ProxyOperationRuntime操作)在
  System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
  消息)在[0]处抛出异常:
  System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
  reqMsg,IMessage retMsg)
  System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
  msgData,Int32类型)位于
  Microsoft.VisualStudio.TestPlatform.Core.ITestExecutorService.StartTestRun(IEnumerable 1 tests, String testRunSettings, TestExecutionContext executionContext, String dataCollectorServiceUri) at JetBrains.ReSharper.UnitTesting.MSTest.Provider.Execution.Wcf.TestExecutorServiceProxy.StartTestRun(IEnumerable 1
  测试,字符串testRunSettings,TestExecutionContext executeContext,
  字符串dataCollectorServiceUri)-内部异常堆栈跟踪结束
  ---在JetBrains.ReSharper.UnitTesting.MSTest.Provider.Execution.Wcf.TestExecutorServiceProxy.StartTestRun(IEnumerable 1 tests, String testRunSettings, TestExecutionContext executionContext, String dataCollectorServiceUri) at JetBrains.ReSharper.UnitTesting.MSTest.Provider.Execution.MsTestExecutionProtocol.StartTestRun() 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上下文)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  340
  
  --- EXCEPTION#1/1 [LoggerException]消息=“转换失败:从事件的状态转换。
  原因:System.ArgumentException:应该至少有一个测试
  测试运行。参数名称:测试--->
  System.ServiceModel.FaultException:应该至少有一个测试
  在测试运行中。参数名称:测试
       服务器堆栈跟踪:
       在System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime
  操作,ProxyRpc&rpc)
       在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔型单向,ProxyOperationRuntime操作,Object [] ins,
  Object []超时,TimeSpan超时)
       在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
  methodCall,ProxyOperationRuntime操作)
       在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
  信息)
       异常重新抛出为[0]:
       在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
  reqMsg,IMessage retMsg)
       在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
  msgData,Int32类型)
       在Microsoft.VisualStudio.TestPlatform.Core.ITestExecutorService.StartTestRun(IEnumerable 1 tests, String testRunSettings, TestExecutionContext executionContext, String dataCollectorServiceUri) at JetBrains.ReSharper.UnitTesting.MSTest.Provider.Execution.Wcf.TestExecutorServiceProxy.StartTestRun(IEnumerable 1
  测试,字符串testRunSettings,TestExecutionContext executeContext,
  字符串dataCollectorServiceUri)
       ---内部异常堆栈跟踪的结尾---
       在JetBrains.ReSharper.UnitTesting.MSTest.Provider.Execution.Wcf.TestExecutorServiceProxy.StartTestRun(IEnumerable 1 tests, String testRunSettings, TestExecutionContext executionContext, String dataCollectorServiceUri) at JetBrains.ReSharper.UnitTesting.MSTest.Provider.Execution.MsTestExecutionProtocol.StartTestRun() 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.UnitTesting.MSTest.Provider.Execution.MsTestExecutionProtocol.<.ctor>b__10(Object sender, TransitionExceptionEventArgs 2个参数)
       在Appccelerate.StateMachine.Machine.StateMachine 2.RaiseEvent[T](EventHandler 1
  eventHandler,T参数,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
  例外)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ Contexts \ TransitionContext.cs:line
  74
       在Appccelerate.StateMachine.Machine.States.State 2.HandleException(Exception exception, ITransitionContext 2上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  307
       在Appccelerate.StateMachine.Machine.States.State 2.HandleEntryActionException(ITransitionContext 2
  上下文,Exception异常)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  357
       在Appccelerate.StateMachine.Machine.States.State 2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext 2上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  345
       在Appccelerate.StateMachine.Machine.States.State 2.ExecuteEntryActions(ITransitionContext 2
  上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  330
       在Appccelerate.StateMachine.Machine.States.State 2.Entry(ITransitionContext 2
  上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  247
       在Appccelerate.StateMachine.Machine.States.State 2.EnterShallow(ITransitionContext 2
  上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  285
       在Appccelerate.StateMachine.Machine.States.State 2.EnterHistoryNone(ITransitionContext 2
  上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  429
       在Appccelerate.StateMachine.Machine.States.State 2.EnterByHistory(ITransitionContext 2
  上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  263
       在Appccelerate.StateMachine.Machine.Transitions.Transition 2.Fire(ITransitionContext 2
  上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ Transitions \ Transition.cs:line
  87
       在Appccelerate.StateMachine.Machine.States.State 2.Fire(ITransitionContext 2
  上下文中)
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ Machine \ States \ State.cs:line
  222
       在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()处
  在
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ PassiveStateMachine.cs:line
  339
       位于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)中
  C:\ projects \ appccelerate \ repos \ statemachine \ source \ Appccelerate.StateMachine \ PassiveStateMachine.cs:line
  177
       在Appccelerate.StateMachine.PassiveStateMachine 2.Fire(TEvent eventId) in C:\projects\appccelerate\repos\statemachine\source\Appccelerate.StateMachine\PassiveStateMachine.cs:line 163 at JetBrains.ReSharper.UnitTesting.MSTest.Provider.Execution.Wcf.TestExecutorServiceClient.TestConnection(IEnumerable 1
  dummyTestResults)
       在SyncInvokeTestConnection(Object,Object [],Object [])
       在System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke处(对象实例,对象[]输入,对象[]&输出)
       在System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&
  rpc)
       在System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
       在System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext
  请求,布尔值cleanThread,OperationContext
  currentOperationContext)
       在System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext
  请求,OperationContext currentOperationContext)
       在System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult
  结果)
       在System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult
  结果)
       在System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult
  结果)
       在System.Runtime.AsyncResult.Complete处(布尔值已同步完成)
       在System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult
  结果)
       在System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult
  结果)
       在System.Runtime.AsyncResult.Complete处(布尔值已同步完成)
       在System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object
  州)
       在System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object
  州)
       在System.ServiceModel.Channels.StreamConnection.OnRead(IAsyncResult
  结果)
       在System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult
  结果)
       在System.Net.LazyAsyncResult.Complete(IntPtr userToken)
       在System.Net.LazyAsyncResult.ProtectedInvokeCallback(对象结果,IntPtr userToken)
       在System.Net.Security.NegotiateStream.ProcessFrameBody(Int32 readBytes,Byte []缓冲区,Int32偏移量,Int32计数,
  AsyncProtocolRequest asyncRequest)
       在System.Net.Security.NegotiateStream.ReadCallback(AsyncProtocolRequest
  asyncRequest)
       在System.Net.AsyncProtocolRequest.CompleteRequest(Int32结果)
       在System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32字节)
       在System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
       在System.Runtime.AsyncResult.Complete处(布尔值已同步完成)
       在System.ServiceModel.Channels.ConnectionStream.IOAsyncResult.OnAsyncIOComplete(Object
  州)
       在System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean
  haveResult,Int32错误,Int32 numBytes)
       在System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32
  错误,UInt32 numBytes,NativeOverlapped * nativeOverlapped)
       在System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32
  错误,UInt32 bytesRead,NativeOverlapped * nativeOverlapped)
       在System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
  errorCode,UInt32 numBytes,NativeOverlapped * pOVERLAP)”


是否有人也有此错误,并且知道如何修复它,以便我可以再次调试单元测试?

提前致谢

最佳答案

更新ReSharper时出现此错误,结果是与Microsoft.VisualStudio.TestPlatform相关的引用的NuGet包出现问题。

创建一个新的测试项目并比较这些程序集的版本,这些版本将在创建项目时自动添加。

对于以下程序集,使用版本14.0.0.1可以为我工作:

c# - Resharper无法调试MSTest测试-LMLPHP


ReSharper 2017.3.1
VS 2017 15.5.3

10-05 17:59