Skip to content

Debugging host with an initialized DevCycleClient causes ObjectDisposedException #173

@LVoogd

Description

@LVoogd

Hey!

I'm trying to implement the server-sdk in our backend but figured out that initializing the client causes the debugger to break.

I've distilled it down to the following minimal reproducible code:

Runtime: Microsoft.NETCore.App 9.0.0

Code:

public class Program
{
    public static async Task<int> Main(string[] args)
    {
        // Initialize DevCycle feature flag client
        var client = new DevCycleLocalClientBuilder().SetSDKKey("dvc_server_xxxx").SetOptions(new DevCycleLocalOptions(configPollingIntervalMs: 5000, eventFlushIntervalMs: 1000)).SetInitializedSubscriber(
            (_, e) =>
            {
                if (e.Errors.Count != 0)
                {
                    Console.WriteLine($"DevCycle Client did not initialize. Errors: {e.Errors}");
                }
            }).Build();


        var x = "hi";

        Console.WriteLine(x);
        
        return 1;
    }
}

Hitting a breakpoint on Console.WriteLine(x) causes the debugger to exit with the following errors

10:50:08.766 |E| DebuggerWorker                | Debugger worker MTA main thread:6 | Exception while terminating main lifetime Could not get module of a class. Object is in a zombie state. (0x8013134F). The error code is CORDBG_E_OBJECT_NEUTERED, or 0x8013134F.

--- EXCEPTION #1/2 [COMException]
Message = “Could not get module of a class. Object is in a zombie state. (0x8013134F). The error code is CORDBG_E_OBJECT_NEUTERED, or 0x8013134F.”
ExceptionPath = Root.InnerException
ClassName = System.Runtime.InteropServices.COMException
HResult = CORDBG_E_OBJECT_NEUTERED=8013134F
Source = JetBrains.Platform.Interop
StackTraceString = “
  at JetBrains.UI.Interop.HResultsEx.AssertSucceeded(Int32 hresult, String comment) in AssertSucceeded.il:line IL_0000 mvid E3F6
     at JetBrains.Debugger.CorApi.ComInterop.ICorDebugClassEx.GetModule(ICorDebugClass class) in GetModule.il:line IL_0014 mvid 29E1
     at Mono.Debugging.Win32.CorMetadataUtil.ToJetMetadataTransform.GetTypeInfo(ICorDebugClass corDebugClass) in GetTypeInfo.il:line IL_0000 mvid A9F3
     at Mono.Debugging.Win32.CorMetadataUtil.ToJetMetadataTransform.CreateNamedType(ICorDebugClass corDebugClass, IMetadataType[] typeArguments) in CreateNamedType.il:line IL_0000 mvid A9F3
     at Mono.Debugging.Win32.CorMetadataUtil.GetMetadataType[TMetaType](ICorDebugClass typeClass, ICorTypeToAnotherTypeTransform`1 transform, ICorDebugType[] maybeTypeArgs, ICorDebugComObjectValue comObject) in GetMetadataType.il:line IL_0007 mvid A9F3 or GetMetadataType.il:line IL_0047 mvid A9F3
     at Mono.Debugging.Win32.CorMetadataUtil.GetMetadataType(ICorDebugClass typeClass, CorDebuggerSession session, ICorDebugType[] maybeTypeArgs, ICorDebugComObjectValue comObject) in GetMetadataType.il:line IL_0007 mvid A9F3 or GetMetadataType.il:line IL_0047 mvid A9F3
     at Mono.Debugging.Win32.CorMethodCalls.CorNewObjectNoConstructorCall.GetDescription() in GetDescription.il:line IL_0012 mvid A9F3
     at Mono.Debugging.Win32.CorMethodCalls.CorNewObjectNoConstructorCall.get_Description()
     at Mono.Debugging.Evaluation.AsyncOperationManager.CancelOperations(List`1 operations, Boolean wait) in CancelOperations.il:line IL_0014 mvid BFA4
     at Mono.Debugging.Evaluation.AsyncOperationManager.Dispose() in Dispose.il:line IL_0031 mvid BFA4
     at Autofac.Core.Disposer.Dispose(Boolean disposing) in Dispose.il:line IL_0016 mvid 22D0
     at Autofac.Util.Disposable.Dispose() in Dispose.il:line IL_0010 mvid 22D0
     at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing) in Dispose.il:line IL_0017 mvid 22D0 or Dispose.il:line IL_001E mvid 22D0
     at Autofac.Util.Disposable.Dispose() in Dispose.il:line IL_0010 mvid 22D0
     at JetBrains.Debugger.Worker.DebuggerWorker.<>c__DisplayClass19_1.<CreateSession>b__2(Object _, LifetimeScopeEndingEventArgs __) in DebuggerWorker.il:line IL_0000 mvid C548
     at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing) in Dispose.il:line IL_0017 mvid 22D0 or Dispose.il:line IL_001E mvid 22D0
     at Autofac.Util.Disposable.Dispose() in Dispose.il:line IL_0010 mvid 22D0
     at Autofac.Core.Container.Dispose(Boolean disposing) in Dispose.il:line IL_0003 mvid 22D0
     at Autofac.Util.Disposable.Dispose() in Dispose.il:line IL_0010 mvid 22D0
     at JetBrains.Debugger.Worker.DebuggerWorkerLauncher.<>c__DisplayClass2_2.<Launch>g__TerminateCallback|3(Boolean detached, Boolean keepProcess) in DebuggerWorkerLauncher.il:line IL_00A0 mvid C548
”

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “Exception while terminating main lifetime Could not get module of a class. Object is in a zombie state. (0x8013134F). The error code is CORDBG_E_OBJECT_NEUTERED, or 0x8013134F.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.Util.ILoggerEx.LogException(ILogger this, LoggingLevel level, Exception exception, ExceptionOrigin exceptionOrigin, String comment) in LogException.il:line IL_002E mvid 91A6
     at JetBrains.Util.ILoggerEx.Error(ILogger this, Exception ex, String message) in Error.il:line IL_001B mvid 91A6
     at JetBrains.Debugger.Worker.DebuggerWorkerLauncher.<>c__DisplayClass2_2.<Launch>g__TerminateCallback|3(Boolean detached, Boolean keepProcess)
     at JetBrains.Debugger.Worker.DebuggerWorkerLauncher.<>c__DisplayClass2_2.<Launch>b__4(ValueTuple`2 arg)
     at JetBrains.Collections.Viewable.SignalBase`1.Fire(T value) in Fire.il:line IL_0028 mvid A5E3
     at JetBrains.Debugger.Worker.RiderDebuggerWorker.<>c__DisplayClass20_0.<OnTargetExited>b__0() in RiderDebuggerWorker.il:line IL_006A mvid 9246
     at Mono.Debugging.Threading.QueuedTasks.ProcessDebuggerTask(QueuedDebuggerTask& item) in ProcessDebuggerTask.il:line IL_0041 mvid BFA4
     at Mono.Debugging.Threading.QueuedTasks.Pump(Func`1 condition, TimeSpan timeout, QueuedDebuggerTaskType type) in Pump.il:line IL_0000 mvid BFA4 or Pump.il:line IL_0105 mvid BFA4
     at Mono.Debugging.Evaluation.AsyncOperationManager.Invoke[TValue](AsyncOperationBase`1 mc, Int32 timeout) in Invoke.il:line IL_00E7 mvid BFA4
     at Mono.Debugging.Win32.CorDebuggerSession.RuntimeInvoke(IStackFrame stackFrame, CorCall callArg, IValueFetchOptions options) in RuntimeInvoke.il:line IL_0008 mvid A9F3
     at Mono.Debugging.Win32.CorDebugTypeUtil.NewObjectNoConstructor(ICorDebugType corType, IStackFrame`1 stackFrame, CorDebuggerSession session, IValueFetchOptions options, ICorDebugEval eval) in NewObjectNoConstructor.il:line IL_0047 mvid A9F3
     at Mono.Debugging.Win32.Evaluation.NewGen.VirtualExecution.CorInterpreterContext.NewObjectNoConstructor(ICorDebugType corType, Boolean allowInvokes) in NewObjectNoConstructor.il:line IL_0022 mvid A9F3
     at Mono.Debugging.Win32.Evaluation.NewGen.VirtualExecution.CorInterpreterContext.CopyValueFromMemory(Int64 address, IMetadataType substitutedType) in CopyValueFromMemory.il:line IL_0029 mvid A9F3
     at Mono.Debugging.Evaluation.NewGen.VirtualExecution.InterpreterContextBase`1.DereferenceValueByAddress(Int64 address, IMetadataType asType) in DereferenceValueByAddress.il:line IL_0000 mvid BFA4
     at Mono.Debugging.Evaluation.NewGen.VirtualExecution.InterpreterStackValues.AddressStackValue.Dereference(IMetadataType asType) in Dereference.il:line IL_0220 mvid BFA4
     at Mono.Debugging.Evaluation.NewGen.VirtualExecution.ILCodeInterpreter.Execute() in Execute.il:line IL_0000 mvid BFA4 or Execute.il:line IL_0E68 mvid BFA4
     at Mono.Debugging.Evaluation.NewGen.VirtualExecution.ILCodeInterpreter.ExecuteWithRecursionGuard(IInterpreterContext interpreterContext, IILInterpreterStackFrame interpreterStackFrame, IStaticMembersHolder staticMembersHolder, Lifetime lf, IInterpreterDiagnostics diagnostics, Nullable`1 currentRecursionLevel, ILInterpreterState state) in ExecuteWithRecursionGuard.il:line IL_0032 mvid BFA4
     at Mono.Debugging.Evaluation.NewGen.VirtualExecution.ILCodeInterpreter.Execute(IInterpreterContext interpreterContext, IILInterpreterStackFrame interpreterStackFrame, IStaticMembersHolder staticMembersHolder, Lifetime lf, IInterpreterDiagnostics diagnostics, ILInterpreterState state) in Execute.il:line IL_0000 mvid BFA4 or Execute.il:line IL_0E68 mvid BFA4
     at Mono.Debugging.Win32.DFA.DfaUtils.DoDFA2(IStackFrame frame, IEvaluationOptions options, TypeRepresentationInfoForDFA typeRepresentationInfoForDfa, IDFATypeCompiler debuggerCSharpCompiler, IUserObjects`1 userObjects, SyntheticVariableManager`1 syntheticVariablesSupport, MetadataLoader loader, Lifetime lifetime, ISignal`1 signal, IRoslynReferencesProvider roslynReferencesProvider, NewDFAInfoDto newDFAInfoDto, IStaticDFAInformation staticDFAInformation, ILogger logger, IReadOnlyLoopTracker& readOnlyLoopTracker, IDFATrackerResults& dfaExecutionTrackerResults) in DoDFA2.il:line IL_05D6 mvid A9F3
     at Mono.Debugging.Win32.DFA.DfaUtils.DoDFA(IStackFrame frame, IEvaluationOptions options, NewDFAInfoDto typeRepresentationInfoForDfa, IDFATypeCompiler debuggerCSharpCompiler, IUserObjects`1 userObjects, SyntheticVariableManager`1 syntheticVariablesSupport, MetadataLoader loader, Lifetime lifetime, ISignal`1 signal, IRoslynReferencesProvider roslynReferencesProvider, ILogger logger, IReadOnlyLoopTracker& loopTracker, IDFATrackerResults& dfaTrackerResults) in DoDFA.il:line IL_011C mvid A9F3
     at Mono.Debugging.Win32.DFA.CorDFAManager.DoDFA(IStackFrame stackFrame, IEvaluationOptions options, NewDFAInfoDto typeRepresentationInfoForDfa, Lifetime operationLifetime, ISignal`1 signalToWriteTo, Lifetime pausedContextLifetime) in DoDFA.il:line IL_001F mvid A9F3
     at JetBrains.Debugger.Worker.PausedContext.<>c__DisplayClass33_0.<DoDfa>b__1(IStackFrame frame) in PausedContext.il:line IL_0028 mvid C548 or PausedContext.il:line IL_00A8 mvid C548
     at JetBrains.Debugger.Worker.PausedContext.WithFrame[T](Int32 frameId, Func`2 action) in WithFrame.il:line IL_0036 mvid C548
     at JetBrains.Debugger.Worker.PausedContext.<>c__DisplayClass33_0.<DoDfa>b__0(CancellationToken token) in PausedContext.il:line IL_0028 mvid C548 or PausedContext.il:line IL_00A8 mvid C548
     at JetBrains.Debugger.Worker.IDebugSessionFrontendEx.<>c__DisplayClass1_1`1.<EnqueueTask>b__1() in IDebugSessionFrontendEx.il:line IL_0000 mvid C548 or IDebugSessionFrontendEx.il:line IL_0052 mvid C548
     at JetBrains.Util.Logging.LoggerStructuredEx.DoCalculation[T](Nullable`1 logWithLevel, String key, String message, Func`1 action, Func`2 report) in DoCalculation.il:line IL_0000 mvid 91A6 or DoCalculation.il:line IL_0067 mvid 91A6
     at JetBrains.Util.Logging.LoggerStructuredEx.DoCalculation[T](ILogger logger, String key, String message, Func`1 action) in DoCalculation.il:line IL_0000 mvid 91A6 or DoCalculation.il:line IL_0067 mvid 91A6
     at JetBrains.Debugger.Worker.IDebugSessionFrontendEx.<>c__DisplayClass1_0`1.<EnqueueTask>b__0() in IDebugSessionFrontendEx.il:line IL_0000 mvid C548 or IDebugSessionFrontendEx.il:line IL_0052 mvid C548
     at JetBrains.Debugger.Worker.DebugSessionFrontendBase.<>c__DisplayClass64_0.<EnqueueDebuggerCall>b__0()
     at Mono.Debugging.Threading.QueuedTasks.ProcessDebuggerTask(QueuedDebuggerTask& item) in ProcessDebuggerTask.il:line IL_0041 mvid BFA4
     at Mono.Debugging.Threading.QueuedTasks.Pump(Func`1 condition, TimeSpan timeout, QueuedDebuggerTaskType type) in Pump.il:line IL_0000 mvid BFA4 or Pump.il:line IL_0105 mvid BFA4
     at Mono.Debugging.Threading.QueuedTasks.Pump(Func`1 condition) in Pump.il:line IL_0000 mvid BFA4 or Pump.il:line IL_0105 mvid BFA4
     at Mono.Debugging.Threading.DebuggerDispatcher.Run() in Run.il:line IL_0012 mvid BFA4
     at JetBrains.Debugger.Worker.DebuggerWorker.Run() in Run.il:line IL_0000 mvid C548
     at JetBrains.Debugger.Worker.DebuggerWorkerLauncher.<>c__DisplayClass2_0.<Launch>b__0()
     at System.Threading.Thread.StartCallback() in StartCallback.il:line IL_000E mvid 87BE
”

10:50:08.799 |W| ILCodeInterpreter             | Debugger worker MTA main thread:6 | Could not get module of a class. Object is in a zombie state. (0x8013134F). The error code is CORDBG_E_OBJECT_NEUTERED, or 0x8013134F.

Any ideas?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions