Unable to debug unit test using NUnit and NSubstitute

Answered

Hi, I'm trying to switch from Windows and Visual Studio to Rider and Linux. The project i'm working on was created under Windows and Visual Studio, where i can run the tests without problem. In Rider and Linux everything is working right except when i try to debug the test. While debugging, if i hit a line with some reference to NSubstitute appears the next error:

--- EXCEPTION #1/1 [LoggerException]
Message = “
  Mono.Debugger.Soft.VMDisconnectedException: Exception of type 'Mono.Debugger.Soft.VMDisconnectedException' was thrown.
    at Mono.Debugger.Soft.Connection.SendReceive (Mono.Debugger.Soft.Connection+CommandSet command_set, System.Int32 command, Mono.Debugger.Soft.Connection+PacketWriter packet) [0x0010e] in <fd6fb589647b42c0b5197b46ba140344>:0
    at Mono.Debugger.Soft.Connection.Type_GetPropertyCustomAttributes (System.Int64 id, System.Int64 field_id, System.Int64 attr_type_id, System.Boolean inherit) [0x0001c] in <fd6fb589647b42c0b5197b46ba140344>:0
    at Mono.Debugger.Soft.PropertyInfoMirror.GetCAttrs (Mono.Debugger.Soft.TypeMirror type, System.Boolean inherit) [0x00047] in <fd6fb589647b42c0b5197b46ba140344>:0
    at Mono.Debugger.Soft.PropertyInfoMirror.GetCustomAttributes (System.Boolean inherit) [0x00000] in <fd6fb589647b42c0b5197b46ba140344>:0
    at Mono.Debugging.Soft.SoftDebuggerAdaptor.OnGetTypeDisplayData (Mono.Debugging.Soft.SoftEvaluationContext ctx, Mono.Debugger.Soft.TypeMirror type) [0x0014d] in <070bb25971a04308b1f39bf31038cd70>:0

ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.Util.ILoggerEx.LogMessage (JetBrains.Util.ILogger this, JetBrains.Util.LoggingLevel level, System.String message) [0x00000] in <839a50cdd54e4c5c96207d93008954c0>:0
    at JetBrains.Util.ILoggerEx.Error (JetBrains.Util.ILogger this, System.String message) [0x00000] in <839a50cdd54e4c5c96207d93008954c0>:0
    at JetBrains.Debugger.Worker.DebugSessionBase.OnDebuggerOutput (System.Boolean isStderr, System.String text) [0x00000] in <d501ba18b05247fa83dd9e8b5fd4e691>:0
    at Mono.Debugging.Client.DebuggerSession`3[TContext,TType,TValue].OnDebuggerOutput (System.Boolean isStderr, System.String text) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Soft.SoftDebuggerSession.WriteDebuggerOutput (System.Boolean isError, System.String msg) [0x00000] in <070bb25971a04308b1f39bf31038cd70>:0
    at Mono.Debugging.Soft.SoftDebuggerAdaptor.OnGetTypeDisplayData (Mono.Debugging.Soft.SoftEvaluationContext ctx, Mono.Debugger.Soft.TypeMirror type) [0x00000] in <070bb25971a04308b1f39bf31038cd70>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].GetTypeDisplayData (TContext ctx, TType type) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].CreateObjectValueImpl (TContext ctx, Mono.Debugging.Backend.IObjectValueSource`1[TContext] source, Mono.Debugging.Client.ObjectPath path, TValue obj, Mono.Debugging.Client.ObjectValueFlags flags) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Soft.SoftDebuggerAdaptor.CreateObjectValueImpl (Mono.Debugging.Soft.SoftEvaluationContext ctx, Mono.Debugging.Backend.IObjectValueSource`1[TContext] source, Mono.Debugging.Client.ObjectPath path, Mono.Debugger.Soft.Value obj, Mono.Debugging.Client.ObjectValueFlags flags) [0x00000] in <070bb25971a04308b1f39bf31038cd70>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].CreateObjectValue (TContext ctx, Mono.Debugging.Backend.IObjectValueSource`1[TContext] source, Mono.Debugging.Client.ObjectPath path, TValue obj, Mono.Debugging.Client.ObjectValueFlags flags) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ValueReference`3[TContext,TType,TValue].OnCreateObjectValue (Mono.Debugging.Client.EvaluationOptions options) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ValueReference`3[TContext,TType,TValue].CreateObjectValue (Mono.Debugging.Client.EvaluationOptions options) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ValueReference`3+<>c__DisplayClass2[TContext,TType,TValue].<CreateObjectValue>b__0 () [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.AsyncEvaluationTracker+<>c__DisplayClass3.<Run>b__1 () [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.TimedEvaluator.SafeRun (Mono.Debugging.Evaluation.EvaluatorDelegate del) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.TimedEvaluator.Run (Mono.Debugging.Evaluation.EvaluatorDelegate evaluator, Mono.Debugging.Evaluation.EvaluatorDelegate delayedDoneCallback) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.AsyncEvaluationTracker.Run (System.String name, Mono.Debugging.Client.ObjectValueFlags flags, Mono.Debugging.Evaluation.ObjectEvaluatorDelegate evaluator) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].CreateObjectValueAsync (System.String name, Mono.Debugging.Client.ObjectValueFlags flags, Mono.Debugging.Evaluation.ObjectEvaluatorDelegate evaluator) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ValueReference`3[TContext,TType,TValue].CreateObjectValue (System.Boolean withTimeout, Mono.Debugging.Client.EvaluationOptions options) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ValueReference`3[TContext,TType,TValue].CreateObjectValue (System.Boolean withTimeout) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].GetObjectValueChildrenImpl (TContext ctx, Mono.Debugging.Evaluation.IDebuggerValueOwner`1[TValue] objectSource, TType type, TValue obj, System.Int32 firstItemIndex, System.Int32 count, System.Boolean dereferenceProxy) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3+<>c__DisplayClassf[TContext,TType,TValue].<GetObjectValueChildren>b__e (System.Threading.CancellationToken token) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].PerformWithCancellationToken[T] (System.Func`2[T,TResult] func) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].GetObjectValueChildren (TContext ctx, Mono.Debugging.Evaluation.IDebuggerValueOwner`1[TValue] objectSource, TType type, TValue obj, System.Int32 firstItemIndex, System.Int32 count, System.Boolean dereferenceProxy) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ObjectValueAdaptor`3[TContext,TType,TValue].GetObjectValueChildren (TContext ctx, Mono.Debugging.Evaluation.IDebuggerValueOwner`1[TValue] objectSource, TValue obj, System.Int32 firstItemIndex, System.Int32 count) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ValueReference`3[TContext,TType,TValue].GetChildren (Mono.Debugging.Client.ObjectPath path, System.Int32 index, System.Int32 count, Mono.Debugging.Client.EvaluationOptions options) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Evaluation.ValueReference`3[TContext,TType,TValue].Mono.Debugging.Backend.IObjectValueSource.GetChildren (Mono.Debugging.Client.ObjectPath path, System.Int32 index, System.Int32 count, Mono.Debugging.Client.EvaluationOptions options) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at Mono.Debugging.Client.ObjectValue.GetAllChildrenNoCache (Mono.Debugging.Client.EvaluationOptions options) [0x00000] in <ac526ad3eb874e36bffb317be5c154dc>:0
    at JetBrains.Debugger.Worker.PausedContext+<>c__DisplayClass11.<GetFields>b__f () [0x00000] in <d501ba18b05247fa83dd9e8b5fd4e691>:0
    at JetBrains.Debugger.Worker.DebugSessionBase.EnqueueDebuggerCall (JetBrains.DataFlow.Lifetime lifetime, System.Action task) [0x00000] in <d501ba18b05247fa83dd9e8b5fd4e691>:0
    at JetBrains.Debugger.Worker.PausedContext.GetFields (JetBrains.DataFlow.Lifetime lifetime, JetBrains.Rider.Model.DebuggerWorker.ComputeFieldsArg computeFieldsArg) [0x00000] in <d501ba18b05247fa83dd9e8b5fd4e691>:0
    at JetBrains.Platform.RdFramework.Tasks.RdEndpoint`2+<>c__DisplayClassa[TReq,TRes].<Init>b__7 (JetBrains.Platform.RdFramework.SerializationCtx ctx, JetBrains.Util.PersistentMap.UnsafeReader reader) [0x00000] in <47669fff7fe5482394b66ad319ed9a05>:0
    at JetBrains.Platform.RdFramework.Impl.MessageBroker.Execute (System.Action`2[T1,T2] handler, JetBrains.Platform.RdFramework.RdId id, JetBrains.Platform.RdFramework.SerializationCtx ctx, System.Byte[] msg) [0x00000] in <47669fff7fe5482394b66ad319ed9a05>:0
    at JetBrains.Platform.RdFramework.Impl.MessageBroker+Subscription+<>c__DisplayClassa.<Invoke>b__9 () [0x00000] in <47669fff7fe5482394b66ad319ed9a05>:0
    at JetBrains.Platform.RdFramework.Impl.RdSimpleDispatcher.Run () [0x00000] in <47669fff7fe5482394b66ad319ed9a05>:0
    at JetBrains.Platform.RdFramework.Impl.RdSpecificThreadSimpleDispatcher.Run () [0x00000] in <47669fff7fe5482394b66ad319ed9a05>:0
    at JetBrains.Debugger.Worker.DebuggerWorkerMain.<Main>b__1 () [0x00000] in <d501ba18b05247fa83dd9e8b5fd4e691>:0
    at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00000] in <8efa6bddb4444e1fb94d4df5e52125ea>:0
    at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <8efa6bddb4444e1fb94d4df5e52125ea>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <8efa6bddb4444e1fb94d4df5e52125ea>:0
    at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x00000] in <8efa6bddb4444e1fb94d4df5e52125ea>:0
    at System.Threading.ThreadHelper.ThreadStart () [0x00000] in <8efa6bddb4444e1fb94d4df5e52125ea>:0


java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:132)
    at com.jetbrains.rider.debugger.DebuggerWorkerProcessHandler$1.invoke(DebuggerWorkerProcessHandler.kt:120)
    at com.jetbrains.rider.debugger.DebuggerWorkerProcessHandler$1.invoke(DebuggerWorkerProcessHandler.kt:95)
    at com.jetbrains.rider.util.reactive.Signal.fire(Signal.kt:29)
    at com.jetbrains.rider.framework.impl.RdSignal$1$1.invoke(RdSignal.kt:33)
    at com.jetbrains.rider.framework.impl.RdSignal$1$1.invoke(RdSignal.kt:13)
    at com.jetbrains.rider.framework.MessageBroker$Subscription$invoke$1.invoke(MessageBroker.kt:40)
    at com.jetbrains.rider.framework.MessageBroker$Subscription$invoke$1.invoke(MessageBroker.kt:25)
    at com.jetbrains.rider.protocol.RdDispatcher.flushAll(RdDispatcher.kt:84)
    at com.jetbrains.rider.protocol.RdDispatcher.access$flushAll(RdDispatcher.kt:15)
    at com.jetbrains.rider.protocol.RdDispatcher$flushAllRunnable$1.run(RdDispatcher.kt:18)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:314)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:821)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:649)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
18:31:17.930 | ERROR | DebuggerWorkerProcessHandler   | Rider 2017.2 EAP  Build #RD-172.4144.808
18:31:17.930 | ERROR | DebuggerWorkerProcessHandler   | JDK: 1.8.0_152-release
18:31:17.930 | ERROR | DebuggerWorkerProcessHandler   | VM: OpenJDK 64-Bit Server VM
18:31:17.930 | ERROR | DebuggerWorkerProcessHandler   | Vendor: JetBrains s.r.o
18:31:17.930 | ERROR | DebuggerWorkerProcessHandler   | OS: Linux
18:31:17.930 | ERROR | DebuggerWorkerProcessHandler   | Last Action: StepOver
18:31:17.989 | INFO  | SocketWire$Server              | FrontendToDebugWorker: start terminating lifetime
18:31:17.990 | INFO  | SocketWire$Server              | FrontendToDebugWorker: termination finished
18:31:19.663 | INFO  | LogsAttachListener             | Packed logs in 716 ms
18:35:36.433 | INFO  | IdeScriptEngineManager         | javax.script.ScriptEngineManager

I'm using Rider 2017.2 EAP, set debug type to portable, target framework is 4.5 and core .net 2.0.

Have i missed something?

I would really appreciate any help

1 comment
Comment actions Permalink

Hi! Does this work on VS for Mac? I believe that this is mono problem, not Rider's. Also, this seems related: https://stackoverflow.com/questions/40466992/mono-net-nunit-projects-mock-of-interface-with-auto-property-prevents-debuggin

0

Please sign in to leave a comment.