microsoft / VSDebugAdapterHost

Visual Studio Debug Adapter Host
MIT License
77 stars 20 forks source link

Empty string `moduleId` causes InvalidOperationException #19

Closed adityaaswani closed 2 years ago

adityaaswani commented 2 years ago

We tried to use a Debug Adapter written for VSCode along with VS. We see that the brakpoint is hit but VS crashes when reading the response for stackTrace request. Below are the details.

P.S. The same response is succesfully parsed by VSCode.

Am I missing something? ANy setting that we need to do first?

1> [DebugAdapter] --> C (stackTrace-7): {"type":"request","command":"stackTrace","arguments":{"threadId":6758,"startFrame":0,"levels":1},"seq":7} 1> [DebugAdapter] <-- R (stackTrace-7) [105 ms]: {"type":"response","request_seq":7,"success":true,"command":"stackTrace","body":{"stackFrames":[{"column":13,"endColumn":29,"endLine":11,"id":0,"line":11,"moduleId":"478591e3-c030-4fb3-9f3d-792271a49de0","name":"NUITemplate1.Program.OnCreate()","source":{"name":"NUITemplate1.cs","path":"C:\Users\a.aswani\source\repos\NUITemplate1\NUITemplate1\NUITemplate1.cs"}}],"totalFrames":10},"seq":28} 1> [DebugAdapter] --> C (stackTrace-8): {"type":"request","command":"stackTrace","arguments":{"threadId":6758,"startFrame":0,"levels":1000},"seq":8} 1> [DebugAdapter] <-- R (stackTrace-8) [56 ms]: {"type":"response","request_seq":8,"success":true,"command":"stackTrace","body":{"stackFrames":[{"column":13,"endColumn":29,"endLine":11,"id":0,"line":11,"moduleId":"478591e3-c030-4fb3-9f3d-792271a49de0","name":"NUITemplate1.Program.OnCreate()","source":{"name":"NUITemplate1.cs","path":"C:\Users\a.aswani\source\repos\NUITemplate1\NUITemplate1\NUITemplate1.cs"}},{"column":0,"endColumn":0,"endLine":0,"id":1,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":2,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":3,"line":0,"moduleId":"","name":"[Native Frame]"},{"column":0,"endColumn":0,"endLine":0,"id":4,"line":0,"moduleId":"","name":"[Native Frame]"},{"column":0,"endColumn":0,"endLine":0,"id":5,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":6,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":7,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":8,"line":0,"moduleId":"","name":"[External Code]"},{"column":13,"endColumn":27,"endLine":46,"id":9,"line":46,"moduleId":"478591e3-c030-4fb3-9f3d-792271a49de0","name":"NUITemplate1.Program.Main()","source":{"name":"NUITemplate1.cs","path":"C:\Users\a.aswani\source\repos\NUITemplate1\NUITemplate1\NUITemplate1.cs"}}],"totalFrames":10},"seq":29} 1> ERROR: InvalidOperationException: Unable to locate module with id ''!

1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.CancellableWaitCore[TResult](Task task, Func1 getResultFunc, TResult onCancelResult, IDebuggedProcess process, WaitErrorHandlingMode errorMode)

Aggregate exception: InvalidOperationException: Unable to locate module with id ''! Inner Exception: InvalidOperationException: Unable to locate module with id ''!

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.ModuleManager.GetModuleById(Object id) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7StackFrame.ConstructFrameInfo(Nullable1 showInHex, enum_FRAMEINFO_FLAGS dwFieldSpec) System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() System.Linq.Buffer1..ctor(IEnumerable1 source) System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.ContinueWhenAll[TResult](IEnumerable1 antecedents, CancellationToken cancellationToken) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7Thread.<>cDisplayClass6_0.b0(IReadOnlyCollection`1 frames) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>cDisplayClass8_0`2.b2(TResult result)

gregg-miskelly commented 2 years ago

Sorry if this is obvious, but VS is unhappy with the moduleId values that you have there. There are two potential problems --

gregg-miskelly commented 2 years ago

Sorry, I didn't read the error message closely enough, it is definitely caused by the frames with empty string modules. Omit the field instead and you should be good.

adityaaswani commented 2 years ago

Hi

  1. The modules event was triggered and all the modules are loaded successfully. Added full logs at the end so you can also confirm that module events are all properly generated and parsed.
  2. The module id is indeed empty, but the response from the debugger is not in our control. The same empty module id is handled gracefully in VSCode. VSCode shows [External Code] Unknown Source & [Native Frame] Unknown Source in the callstack.

Below are the full logs

1> DebugAdapterHost version: 17.0.51004.1 commit:ec0f6779994a03130449792ab5f7428c259c1380 1> Connecting to debug server 'localhost:5711' 1> [DebugAdapter] --> C (initialize-1): {"type":"request","command":"initialize","arguments":{"pathFormat":"path","clientID":"visualstudio","clientName":"Visual Studio","adapterID":null,"locale":"en-US","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"SupportsMessageBox":true,"supportsHandshakeRequest":true,"supportsVsAdditionalBreakpointBinds":true,"supportsHitCountsChange":true,"supportsVsCustomMessages":true,"supportsVariableEnumerators":true},"seq":1} 1> WARNING: Request 'initialize-1' has not received a response within 1000 ms! 1> [DebugAdapter] <-- R (initialize-1) [12341 ms]: {"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConditionalBreakpoints":false,"supportsHitConditionalBreakpoints":false,"supportsFunctionBreakpoints":false,"supportsConfigurationDoneRequest":true,"supportsEvaluateForHovers":false,"supportsStepBack":false,"supportsSetVariable":false,"supportsRestartFrame":false,"supportsStepInTargetsRequest":false,"supportsGotoTargetsRequest":false,"supportsCompletionsRequest":false,"supportsRestartRequest":false,"supportsExceptionOptions":false,"supportsValueFormattingOptions":false,"supportsExceptionInfoRequest":false,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":false,"supportsLoadedSourcesRequest":false,"supportsLogPoints":false,"supportsTerminateThreadsRequest":false,"supportsSetExpression":false,"supportsTerminateRequest":false,"supportsDataBreakpoints":false,"supportsReadMemoryRequest":false,"supportsDisassembleRequest":false,"supportsCancelRequest":false,"supportsBreakpointLocationsRequest":false,"supportsClipboardContext":false,"supportsSteppingGranularity":false,"supportsInstructionBreakpoints":false,"supportsExceptionFilterOptions":false},"seq":1} 1> WARNING: Debug adapter does not support value formatting - user-configurable stack trace formatting will be unavailable. 1> WARNING: Debug adapter does not support 'setVariable' request - all variables will be read-only. 1> WARNING: Debug adapter does not support 'hover' context for evaluations - unexpected side effects may occur. 1> [DebugAdapter] --> C (launch-2): {"type":"request","command":"launch","arguments":{},"seq":2} 1> [DebugAdapter] <-- E (initialized): {"type":"event","event":"initialized","seq":2} 1> [DebugAdapter] <-- R (launch-2) [876 ms]: {"type":"response","request_seq":2,"success":true,"command":"launch","body":{},"seq":1} 1> [DebugAdapter] --> C (setBreakpoints-3): {"type":"request","command":"setBreakpoints","arguments":{"source":{"path":"c:\Users\a.aswani\source\repos\NUITemplate1\NUITemplate1\NUITemplate1.cs","sources":[],"checksums":[]},"breakpoints":[{"line":11,"column":13}],"lines":[11]},"seq":3} 1> [DebugAdapter] <-- R (setBreakpoints-3) [114 ms]: {"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"line":11,"message":"The breakpoint is pending and will be resolved when debugging starts.","verified":false}]},"seq":2} 1> [DebugAdapter] --> C (setExceptionBreakpoints-4): {"type":"request","command":"setExceptionBreakpoints","arguments":{"filters":[]},"seq":4} 1> [DebugAdapter] <-- R (setExceptionBreakpoints-4) [29 ms]: {"type":"response","request_seq":4,"success":true,"command":"setExceptionBreakpoints","body":{},"seq":3} 1> [DebugAdapter] --> C (configurationDone-5): {"type":"request","command":"configurationDone","arguments":{},"seq":5} 1> [DebugAdapter] <-- E (process): {"type":"event","event":"process","body":{"isLocalProcess":true,"name":"/usr/bin/dotnet-launcher","startMethod":"launch","systemProcessId":6758},"seq":4} 1> [DebugAdapter] <-- R (configurationDone-5) [908 ms]: {"type":"response","request_seq":5,"success":true,"command":"configurationDone","body":{},"seq":5} 1> [DebugAdapter] <-- E (thread): {"type":"event","event":"thread","body":{"reason":"started","threadId":6758},"seq":6} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"00099b56-7ad8-473d-875d-65f13f696116","name":"System.Private.CoreLib.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Private.CoreLib.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":7} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"ebc864fb-35a1-4dca-9e7e-59a04a65784e","name":"Tizen.Runtime.dll","path":"/usr/share/dotnet.tizen/framework/Tizen.Runtime.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":8} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"df29eb87-7e9f-4c4b-9edd-908f96a6834f","name":"System.Runtime.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Runtime.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":9} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"2e0d571d-2128-4b39-9032-31182bc2484e","name":"System.Runtime.Extensions.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Runtime.Extensions.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":10} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"478591e3-c030-4fb3-9f3d-792271a49de0","name":"NUITemplate1.dll","path":"/proc/6758/fd/36/bin/NUITemplate1.dll","symbolStatus":"Symbols loaded."},"reason":"new"},"seq":11} 1> [DebugAdapter] <-- E (breakpoint): {"type":"event","event":"breakpoint","body":{"breakpoint":{"endLine":11,"id":1,"line":11,"message":"","verified":true},"reason":"changed"},"seq":12} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"816d026d-e9fe-4132-a36e-803fe3bf7feb","name":"Tizen.NUI.dll","path":"/usr/share/dotnet.tizen/framework/Tizen.NUI.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":13} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"3fb73fc1-e2c5-435a-b059-011174a23f1f","name":"Tizen.Applications.Common.dll","path":"/usr/share/dotnet.tizen/framework/Tizen.Applications.Common.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":14} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"5dba1da7-5f23-4e18-8f46-a46537893fde","name":"netstandard.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/netstandard.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":15} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"2a8c404f-0a94-4463-a051-29c6cb67dd2c","name":"System.Threading.Thread.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Threading.Thread.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":16} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"d9376556-e610-46e1-9fe8-229be121feae","name":"System.Collections.Concurrent.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Collections.Concurrent.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":17} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"c8e20b8f-2929-4bee-a275-f338a887cf61","name":"System.Collections.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Collections.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":18} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"e9e2e1d6-c512-4bed-b54c-67c9c2c00524","name":"System.Threading.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Threading.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":19} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"efc49c7d-1efb-403b-9f59-7404a7efc21f","name":"System.Runtime.InteropServices.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Runtime.InteropServices.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":20} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"a30ecf3b-733f-4051-a726-ea5a1dfa3c3d","name":"System.ObjectModel.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.ObjectModel.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":21} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"2eb1b3b0-805c-4d3b-a8ad-7d4937deb822","name":"Tizen.dll","path":"/usr/share/dotnet.tizen/framework/Tizen.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":22} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"bd5aaf7a-ae51-47b1-b189-ccb9554fce8e","name":"Tizen.Log.dll","path":"/usr/share/dotnet.tizen/framework/Tizen.Log.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":23} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"c15a29c8-7ec7-4306-ae4f-a9ccc2e0aec0","name":"System.Diagnostics.StackTrace.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Diagnostics.StackTrace.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":24} 1> [DebugAdapter] <-- E (module): {"type":"event","event":"module","body":{"module":{"id":"b9fffa67-b79d-4c7d-b4a9-0e4c1a061442","name":"System.Private.Uri.dll","path":"/usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.3/System.Private.Uri.dll","symbolStatus":"Symbols not found."},"reason":"new"},"seq":25} 1> [DebugAdapter] <-- E (stopped): {"type":"event","event":"stopped","body":{"allThreadsStopped":true,"reason":"breakpoint","threadId":6758},"seq":26} 1> [DebugAdapter] --> C (threads-6): {"type":"request","command":"threads","arguments":{},"seq":6} 1> [DebugAdapter] <-- R (threads-6) [59 ms]: {"type":"response","request_seq":6,"success":true,"command":"threads","body":{"threads":[{"id":6758,"name":""}]},"seq":27} 1> [DebugAdapter] --> C (stackTrace-7): {"type":"request","command":"stackTrace","arguments":{"threadId":6758,"startFrame":0,"levels":1},"seq":7} 1> [DebugAdapter] <-- R (stackTrace-7) [105 ms]: {"type":"response","request_seq":7,"success":true,"command":"stackTrace","body":{"stackFrames":[{"column":13,"endColumn":29,"endLine":11,"id":0,"line":11,"moduleId":"478591e3-c030-4fb3-9f3d-792271a49de0","name":"NUITemplate1.Program.OnCreate()","source":{"name":"NUITemplate1.cs","path":"C:\Users\a.aswani\source\repos\NUITemplate1\NUITemplate1\NUITemplate1.cs"}}],"totalFrames":10},"seq":28} 1> [DebugAdapter] --> C (stackTrace-8): {"type":"request","command":"stackTrace","arguments":{"threadId":6758,"startFrame":0,"levels":1000},"seq":8} 1> [DebugAdapter] <-- R (stackTrace-8) [56 ms]: {"type":"response","request_seq":8,"success":true,"command":"stackTrace","body":{"stackFrames":[{"column":13,"endColumn":29,"endLine":11,"id":0,"line":11,"moduleId":"478591e3-c030-4fb3-9f3d-792271a49de0","name":"NUITemplate1.Program.OnCreate()","source":{"name":"NUITemplate1.cs","path":"C:\Users\a.aswani\source\repos\NUITemplate1\NUITemplate1\NUITemplate1.cs"}},{"column":0,"endColumn":0,"endLine":0,"id":1,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":2,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":3,"line":0,"moduleId":"","name":"[Native Frame]"},{"column":0,"endColumn":0,"endLine":0,"id":4,"line":0,"moduleId":"","name":"[Native Frame]"},{"column":0,"endColumn":0,"endLine":0,"id":5,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":6,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":7,"line":0,"moduleId":"","name":"[External Code]"},{"column":0,"endColumn":0,"endLine":0,"id":8,"line":0,"moduleId":"","name":"[External Code]"},{"column":13,"endColumn":27,"endLine":46,"id":9,"line":46,"moduleId":"478591e3-c030-4fb3-9f3d-792271a49de0","name":"NUITemplate1.Program.Main()","source":{"name":"NUITemplate1.cs","path":"C:\Users\a.aswani\source\repos\NUITemplate1\NUITemplate1\NUITemplate1.cs"}}],"totalFrames":10},"seq":29} 1> ERROR: InvalidOperationException: Unable to locate module with id ''!

1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.CancellableWaitCore[TResult](Task task, Func1 getResultFunc, TResult onCancelResult, IDebuggedProcess process, WaitErrorHandlingMode errorMode)

Aggregate exception: InvalidOperationException: Unable to locate module with id ''! Inner Exception: InvalidOperationException: Unable to locate module with id ''!

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.ModuleManager.GetModuleById(Object id) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7StackFrame.ConstructFrameInfo(Nullable1 showInHex, enum_FRAMEINFO_FLAGS dwFieldSpec) System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() System.Linq.Buffer1..ctor(IEnumerable1 source) System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.ContinueWhenAll[TResult](IEnumerable1 antecedents, CancellationToken cancellationToken) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7Thread.<>cDisplayClass6_0.b0(IReadOnlyCollection`1 frames) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>cDisplayClass8_0`2.b2(TResult result)

1> ERROR: One or more errors occurred.

Unable to locate module with id ''! 1> ERROR: InvalidOperationException: Unable to locate module with id ''!

1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.CancellableWaitCore[TResult](Task task, Func1 getResultFunc, TResult onCancelResult, IDebuggedProcess process, WaitErrorHandlingMode errorMode)

Aggregate exception: InvalidOperationException: Unable to locate module with id ''! Inner Exception: InvalidOperationException: Unable to locate module with id ''!

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.ModuleManager.GetModuleById(Object id) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7StackFrame.ConstructFrameInfo(Nullable1 showInHex, enum_FRAMEINFO_FLAGS dwFieldSpec) System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() System.Linq.Buffer1..ctor(IEnumerable1 source) System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.ContinueWhenAll[TResult](IEnumerable1 antecedents, CancellationToken cancellationToken) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7Thread.<>cDisplayClass6_0.b0(IReadOnlyCollection`1 frames) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>cDisplayClass8_0`2.b2(TResult result)

1> ERROR: One or more errors occurred.

Unable to locate module with id ''! 1> ERROR: InvalidOperationException: Unable to locate module with id ''!

1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.CancellableWaitCore[TResult](Task task, Func1 getResultFunc, TResult onCancelResult, IDebuggedProcess process, WaitErrorHandlingMode errorMode)

Aggregate exception: InvalidOperationException: Unable to locate module with id ''! Inner Exception: InvalidOperationException: Unable to locate module with id ''!

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.ModuleManager.GetModuleById(Object id) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7StackFrame.ConstructFrameInfo(Nullable1 showInHex, enum_FRAMEINFO_FLAGS dwFieldSpec) System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() System.Linq.Buffer1..ctor(IEnumerable1 source) System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.ContinueWhenAll[TResult](IEnumerable1 antecedents, CancellationToken cancellationToken) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7Thread.<>cDisplayClass6_0.b0(IReadOnlyCollection`1 frames) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>cDisplayClass8_0`2.b2(TResult result)

1> ERROR: One or more errors occurred.

Unable to locate module with id ''! 1> ERROR: InvalidOperationException: Unable to locate module with id ''!

1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.CancellableWaitCore[TResult](Task task, Func1 getResultFunc, TResult onCancelResult, IDebuggedProcess process, WaitErrorHandlingMode errorMode)

Aggregate exception: InvalidOperationException: Unable to locate module with id ''! Inner Exception: InvalidOperationException: Unable to locate module with id ''!

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.ModuleManager.GetModuleById(Object id) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7StackFrame.ConstructFrameInfo(Nullable1 showInHex, enum_FRAMEINFO_FLAGS dwFieldSpec) System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() System.Linq.Buffer1..ctor(IEnumerable1 source) System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.ContinueWhenAll[TResult](IEnumerable1 antecedents, CancellationToken cancellationToken) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7Thread.<>cDisplayClass6_0.b0(IReadOnlyCollection`1 frames) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>cDisplayClass8_0`2.b2(TResult result)

1> ERROR: One or more errors occurred.

Unable to locate module with id ''! 1> ERROR: InvalidOperationException: Unable to locate module with id ''!

1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.CancellableWaitCore[TResult](Task task, Func1 getResultFunc, TResult onCancelResult, IDebuggedProcess process, WaitErrorHandlingMode errorMode)

Aggregate exception: InvalidOperationException: Unable to locate module with id ''! Inner Exception: InvalidOperationException: Unable to locate module with id ''!

Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Engine.Implementation.ModuleManager.GetModuleById(Object id) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7StackFrame.ConstructFrameInfo(Nullable1 showInHex, enum_FRAMEINFO_FLAGS dwFieldSpec) System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() System.Linq.Buffer1..ctor(IEnumerable1 source) System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.ContinueWhenAll[TResult](IEnumerable1 antecedents, CancellationToken cancellationToken) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.AD7.Implementation.AD7Thread.<>cDisplayClass6_0.b0(IReadOnlyCollection`1 frames) Microsoft.VisualStudio.Debugger.VSCodeDebuggerHost.Utilities.TaskExtensions.<>cDisplayClass8_0`2.b2(TResult result)

1> ERROR: One or more errors occurred.

Unable to locate module with id ''! 1> Debug adapter process exited. 1> WARNING: Stopping due to fatal error: AggregateException: One or more errors occurred. 1> ERROR: Unexpected error

AggregateException: One or more errors occurred.

System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Protocol.DebugProtocol.ReaderThreadProc()

Aggregate exception: ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'. Inner Exception: ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'.

System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) System.Threading.Tasks.TaskFactory1.FromAsyncTrimPromise1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)

1> ERROR: One or more errors occurred.

Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'.

gregg-miskelly commented 2 years ago

@andrewcrawley I think I am of the opinion that ideally VS would treat an empty string for moduleId the same as unspecified. Does this seem reasonable to you as well? If so, would you have the cycles to implement it?

@adityaaswani:

... but the response from the debugger is not in our control.

To be clear, if we decide to fix VS to ignore an empty moduleId, this would only be for future versions of VS. So, if you can fix the debugger, I would suggest doing so. Using an empty module id to mean the same thing as unspecified is a grey zone of the DAP protocol -- the behavior is left unspecified. So, it would be best if the debugger omitted this rather than assuming that a client will treat empty and unspecified as the same.

The same empty module id is handled gracefully in VSCode.

To be clear, VS Code is not a particularly interesting comparison when it comes to moduleId as I believe VS Code does nothing with them at all. VS Code would likely ignore content that is clearly incorrect.

andrewcrawley commented 2 years ago

Yeah, I think it makes sense to treat "empty" and "unspecified" the same, and it should be a relatively easy fix.

andrewcrawley commented 2 years ago

As of VS 17.2, an empty moduleId should be treated the same as one that isn't specified at all.