Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger silently fails to connect to target process on Arch #3775

Closed
bDarbonne opened this issue May 11, 2020 · 15 comments
Closed

Debugger silently fails to connect to target process on Arch #3775

bDarbonne opened this issue May 11, 2020 · 15 comments

Comments

@bDarbonne
Copy link

bDarbonne commented May 11, 2020

Issue Description

Breakpoints do not work when running either a console or web application...most of the time.
On occasion, it will randomly begin running correctly. Even when stopping and immediately starting the project again.

Steps to Reproduce

dotnet new console
// set breakpoint
// debug project

or

dotnet new mvc
// set breakpoint in controller
// debug project

Expected Behavior

Program to stop execution on breakpoints selected

Actual Behavior

console -> Program runs to end of execution (this was a new console project)

mvc -> Breakpoint is grayed out and never hit
// hovering over the grayed out breakpoint gives the message: 'The breakpoint is pending and will be resolved when debugging starts.'

Logs

NOTE: These logs were from running a new mvc project

OmniSharp log

Starting OmniSharp server at 5/11/2020, 8:34:56 AM
Target: /[path]/[to]/[project]/demo

OmniSharp server started with Mono 6.4.0.
Path: /home/[user]/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/OmniSharp.exe
PID: 4375

Starting OmniSharp on arch 0.0 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[warn]: OmniSharp.MSBuild.Discovery.Providers.MonoInstanceProvider
It looks like you have Mono 6.4.0 or greater installed but MSBuild could not be found.
Try installing MSBuild into Mono (e.g. 'sudo apt-get install msbuild') to enable better MSBuild support, or upgrade to latest Mono: https://www.mono-project.com/download/stable/.
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.4 - "/home/[user]/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild/Current/Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/[user]/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.4 - "/home/[user]/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/[user]/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/[user]/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/[user]/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/[path]/[to]/[project]/demo'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/[path]/[to]/[project]/demo'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for '/[path]/[to]/[project]/demo/demo.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/[path]/[to]/[project]/demo'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
info: OmniSharp.MSBuild.ProjectManager
Loading project: /[path]/[to]/[project]/demo/demo.csproj
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/[path]/[to]/[project]/demo' on host 4176.
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/[path]/[to]/[project]/demo/demo.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project '/[path]/[to]/[project]/demo/demo.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: demo

C# log

(no output)

Environment information

VSCode version: 1.45.0
C# Extension: 1.21.18

Mono Information OmniSharp using global mono :6.4.0
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.103 Commit: 6f74c4a1dd

Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/3.1.103/

Host (useful for support):
Version: 3.1.3
Commit: ed88943d24

.NET Core SDKs installed:
3.1.103 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
asp-net-core-vs-code-extension-pack temilaj 1.0.3
aspnet-helper schneiderpat 0.6.4
cpptools ms-vscode 0.27.1
csharp ms-dotnettools 1.21.18
Csharp-ASPNETCore rahulsahay 1.11.0
csharpextensions jchannon 1.3.1
docomment k--kato 0.1.9
dotnet-test-explorer formulahendry 0.7.1
gc-excelviewer GrapeCity 2.1.34
java redhat 0.61.0
mssql ms-mssql 1.9.0
python ms-python 2020.4.76186
razor-plus austincummings 0.1.4
remote-containers ms-vscode-remote 0.117.0
vsc-community-material-theme Equinusocio 1.4.1
vsc-material-theme Equinusocio 32.6.0
vsc-material-theme-icons equinusocio 1.1.4
vscode-docker ms-azuretools 1.1.0
vscode-java-debug vscjava 0.25.1
vscode-java-dependency vscjava 0.10.0
vscode-java-pack vscjava 0.9.0
vscode-java-test vscjava 0.22.3
vscode-maven vscjava 0.21.3
vscode-typescript-tslint-plugin ms-vscode 1.2.3
vscodeintellicode VisualStudioExptTeam 1.2.7
vsliveshare ms-vsliveshare 1.0.2106
@bDarbonne
Copy link
Author

I realize this is similar to issue #3773. There are differences:

  • The breakpoints do not work
  • There seems to be no error given

Also did try this: https://github.com/OmniSharp/omnisharp-vscode/wiki/Enabling-C%23-debugger-logging#full-method

Here's the output:
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}

<- (R) {"seq":1,"type":"response","request_seq":1,"success":true,"command":"initialize","message":"","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"All Exceptions","default":false},{"filter":"user-unhandled","label":"User-Unhandled Exceptions","default":true}],"supportsSetVariable":true,"supportsGotoTargetsRequest":true,"supportsModulesRequest":true,"additionalModuleColumns":[],"supportedChecksumAlgorithms":["MD5","SHA1","SHA256"],"supportsExceptionOptions":true,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsSetExpression":true,"supportsReadMemoryRequest":true,"supportsExceptionConditions":true,"supportsLoadSymbolsRequest":true,"supportsModuleSymbolSearchLog":true,"supportsDebuggerProperties":true,"supportsSetSymbolOptions":true}}

-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}

<- (R) {"seq":4,"type":"response","request_seq":1,"success":true,"command":"initialize","message":"","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"All Exceptions","default":false},{"filter":"user-unhandled","label":"User-Unhandled Exceptions","default":true}],"supportsSetVariable":true,"supportsGotoTargetsRequest":true,"supportsModulesRequest":true,"additionalModuleColumns":[],"supportedChecksumAlgorithms":["MD5","SHA1","SHA256"],"supportsExceptionOptions":true,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsSetExpression":true,"supportsReadMemoryRequest":true,"supportsExceptionConditions":true,"supportsLoadSymbolsRequest":true,"supportsModuleSymbolSearchLog":true,"supportsDebuggerProperties":true,"supportsSetSymbolOptions":true}}

-> (C) {"command":"launch","arguments":{"name":".NET Core Launch (web)","type":"coreclr","request":"launch","preLaunchTask":"build","program":"/[path]/[to]/[project]/demo/bin/Debug/netcoreapp3.1/demo.dll","args":[],"cwd":"/[path]/[to]/[project]/demo","stopAtEntry":false,"serverReadyAction":{"action":"openExternally","pattern":"^\s*Now listening on:\s+(https?://\S+)"},"env":{"ASPNETCORE_ENVIRONMENT":"Development","ASPNETCORE_URLS":"https://localhost:5001;http://localhost:5000"},"sourceFileMap":{"/Views":"/[path]/[to]/[project]/demo/Views"},"logging":{"engineLogging":false},"debugServer":4711,"noDebug":true,"internalConsoleOptions":"openOnSessionStart","__sessionId":"178c63ed-f3f3-49df-b5ee-1f1f92221172"},"type":"request","seq":2}

-> (C) {"seq":7,"type":"request","command":"handshake","arguments":{"value":"1wnOLCxVzYltSow7yPp8gXLiSMgWFPQDZ83+w2PqBn0="}}


You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.

@bDarbonne
Copy link
Author

The "noDebug":true kinda has me wondering.

@gregg-miskelly gregg-miskelly changed the title Unable to debug .NET Core 3.1 projects Unable to debug .NET Core 3.1 projects on Arch May 11, 2020
@gregg-miskelly
Copy link
Contributor

@bDarbonne Is that the end of your debug log? It is strangely truncated, maybe because vsdbg-ui crashed? You might get more info using the 'full method'.

@paulsebeikin
Copy link

Hi All, I have the same issue. Here is my debug log using the "full method" described here: [https://github.com/OmniSharp/omnisharp-vscode/wiki/Enabling-C%23-debugger-logging#full-method]. Is there any workaround for this?

Waiting for communication on port 4711...

accepted connection from client
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Code - OSS","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-gb","supportsProgressReporting":true},"type":"request","seq":1}
<- (R) {"seq":0,"type":"response","request_seq":1,"success":true,"command":"initialize","message":"","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"All Exceptions","default":false},{"filter":"user-unhandled","label":"User-Unhandled Exceptions","default":true}],"supportsSetVariable":true,"supportsGotoTargetsRequest":true,"supportsModulesRequest":true,"additionalModuleColumns":[],"supportedChecksumAlgorithms":["MD5","SHA1","SHA256"],"supportsExceptionOptions":true,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsSetExpression":true,"supportsReadMemoryRequest":true,"supportsExceptionConditions":true,"supportsLoadSymbolsRequest":true,"supportsModuleSymbolSearchLog":true,"supportsDebuggerProperties":true,"supportsSetSymbolOptions":true}}
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Code - OSS","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-gb","supportsProgressReporting":true},"type":"request","seq":1}
-> (C) {"command":"launch","arguments":{"name":".NET Core Launch (console)","type":"coreclr","request":"launch","preLaunchTask":"build","program":"/home/pauls/Dev/sandbox/c#/ConsoleApp/bin/Debug/netcoreapp3.1/ConsoleApp.dll","args":[],"cwd":"/home/pauls/Dev/sandbox/c#/ConsoleApp","logging":{"engineLogging":false},"console":"internalConsole","stopAtEntry":false,"debugServer":4711,"internalConsoleOptions":"openOnSessionStart","__sessionId":"eaa62012-7144-40b7-9bb0-bf86654dfc1c"},"type":"request","seq":2}
<- (E) {"seq":3,"type":"event","event":"output","body":{"category":"console","output":"-------------------------------------------------------------------\nYou may only use the Microsoft .NET Core Debugger (vsdbg) with\nVisual Studio Code, Visual Studio or Visual Studio for Mac software\nto help you develop and test your applications.\n-------------------------------------------------------------------\n"}}
<- (R) {"seq":4,"type":"response","request_seq":2,"success":true,"command":"launch"}
<- (E) {"seq":5,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/CommandFailed","data":{"VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.ErrorCode":-1989017584,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"d241e93b","VS.Diagnostics.Debugger.vsdbg.Command":"handshake","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.6.20415.1 commit:0184bb70e1ed40656c0dfa53125805036207007b"}}}
<- (R) {"seq":6,"type":"response","request_seq":1,"success":false,"command":"handshake","message":"Error processing 'handshake' request. Unknown Error: 0x89720010"}

@gregg-miskelly
Copy link
Contributor

@paulsebeikin: your issue is actually different. Your problem is that you installed the OSS version of Visual Studio Code, but the debugger is only licensed to work in official Microsoft products. Unfortunately due to both a bug in the debugger, and a bug in VS Code, that error message doesn't come up. You can fix the issue by installing the official version of VS Code from Microsoft. More info: https://github.com/OmniSharp/omnisharp-vscode/wiki/Microsoft-.NET-Core-Debugger-licensing-and-Microsoft-Visual-Studio-Code

@bDarbonne
Copy link
Author

@gregg-miskelly Yes. That's the end of the debug log. The output was actually from ./vsdbg-ui --server --engineLogging.

Here is the output from ./vsdbg-ui --server --consoleLogging:

Waiting for communication on port 4711...

accepted connection from client
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}
<- (R) {"seq":0,"type":"response","request_seq":1,"success":true,"command":"initialize","message":"","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"all","label":"All Exceptions","default":false},{"filter":"user-unhandled","label":"User-Unhandled Exceptions","default":true}],"supportsSetVariable":true,"supportsGotoTargetsRequest":true,"supportsModulesRequest":true,"additionalModuleColumns":[],"supportedChecksumAlgorithms":["MD5","SHA1","SHA256"],"supportsExceptionOptions":true,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsSetExpression":true,"supportsReadMemoryRequest":true,"supportsExceptionConditions":true,"supportsLoadSymbolsRequest":true,"supportsModuleSymbolSearchLog":true,"supportsDebuggerProperties":true,"supportsSetSymbolOptions":true}}
-> (C) {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"coreclr","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}
-> (C) {"command":"launch","arguments":{"name":"launch - manual debugger","type":"coreclr","request":"launch","preLaunchTask":"build","program":"/[path]/[to]/[project]/demo/bin/Debug/netcoreapp3.1/demo.dll","args":[],"cwd":"/[path]/[to]/[project]/demo","stopAtEntry":false,"serverReadyAction":{"action":"openExternally","pattern":"^\s*Now listening on:\s+(https?://\S+)"},"env":{"ASPNETCORE_ENVIRONMENT":"Development","ASPNETCORE_URLS":"https://localhost:5001;http://localhost:5000"},"sourceFileMap":{"/Views":"/[path]/[to]/[project]/demo/Views"},"logging":{"engineLogging":false},"debugServer":4711,"noDebug":true,"internalConsoleOptions":"openOnSessionStart","__sessionId":"a0c1eaaa-122d-4ab3-890c-44887b05b377"},"type":"request","seq":2}
<- (E) {"seq":3,"type":"event","event":"output","body":{"category":"console","output":"-------------------------------------------------------------------\nYou may only use the Microsoft .NET Core Debugger (vsdbg) with\nVisual Studio Code, Visual Studio or Visual Studio for Mac software\nto help you develop and test your applications.\n-------------------------------------------------------------------\n"}}
<- (R) {"seq":4,"type":"response","request_seq":2,"success":true,"command":"launch"}
<- (E) {"seq":5,"type":"event","event":"initialized","body":{}}
-> (C) {"command":"setBreakpoints","arguments":{"source":{"name":"HomeController.cs","path":"/[path]/[to]/[project]/demo/Controllers/HomeController.cs","checksums":[{"algorithm":"SHA1","checksum":"499f334cbbd92ca9d80169f2b828b50f0ad45432"},{"algorithm":"SHA256","checksum":"2116510a12be6daa6c6d779aa1a699461464f26e63b78f8c1a39af300dcc0546"},{"algorithm":"SHA1","checksum":"e99e2cbf015da6e56326de2deebebbd8062d639a"},{"algorithm":"SHA256","checksum":"923c5ae532d651f687631e2b3c159e3e2a1be124f337721f45f8398b6520f296"}]},"lines":[17],"breakpoints":[{"line":17}],"sourceModified":false},"type":"request","seq":3}
<- (R) {"seq":6,"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","message":"","body":{"breakpoints":[{"id":1,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":17}]}}
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":["user-unhandled"]},"type":"request","seq":4}
<- (R) {"seq":7,"type":"response","request_seq":4,"success":true,"command":"setExceptionBreakpoints"}
-> (C) {"command":"configurationDone","type":"request","seq":5}
<- (E) {"seq":8,"type":"event","event":"process","body":{"name":"/[path]/[to]/[project]/demo/bin/Debug/netcoreapp3.1/demo.dll","systemProcessId":4951,"isLocalProcess":true,"startMethod":null}}
<- (E) {"seq":9,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/Launch","data":{"VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.SourceFileMappings":1,"VS.Diagnostics.Debugger.vsdbg.VisualizerFileUsed":false,"VS.Diagnostics.Debugger.vsdbg.Launch.Duration":140,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"arch","VS.Diagnostics.Debugger.vsdbg.TargetType":"Live","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.6.20415.1 commit:0184bb70e1ed40656c0dfa53125805036207007b"}}}
<- (R) {"seq":10,"type":"response","request_seq":5,"success":true,"command":"configurationDone"}
-> (C) {"command":"threads","type":"request","seq":6}
<- (E) {"seq":11,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/CommandFailed","data":{"VS.Diagnostics.Debugger.vsdbg.AdapterId":"coreclr","VS.Diagnostics.Debugger.vsdbg.ErrorCode":-2147019873,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"arch","VS.Diagnostics.Debugger.vsdbg.Command":"threads","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.6.20415.1 commit:0184bb70e1ed40656c0dfa53125805036207007b"}}}
<- (R) {"seq":12,"type":"response","request_seq":6,"success":false,"command":"threads","message":"Error processing 'threads' request. Unknown Error: 0x8007139f"}
<- (E) {"seq":13,"type":"event","event":"output","body":{"category":"stdout","output":"\u001B[40m\u001B[32minfo\u001B[39m\u001B[22m\u001B[49m: Microsoft.Hosting.Lifetime[0]\n"}}
<- (E) {"seq":14,"type":"event","event":"output","body":{"category":"stdout","output":" Now listening on: https://localhost:5001\n"}}
<- (E) {"seq":15,"type":"event","event":"output","body":{"category":"stdout","output":"\u001B[40m\u001B[32minfo\u001B[39m\u001B[22m\u001B[49m: Microsoft.Hosting.Lifetime[0]\n"}}
<- (E) {"seq":16,"type":"event","event":"output","body":{"category":"stdout","output":" Now listening on: http://localhost:5000\n"}}
<- (E) {"seq":17,"type":"event","event":"output","body":{"category":"stdout","output":"\u001B[40m\u001B[32minfo\u001B[39m\u001B[22m\u001B[49m: Microsoft.Hosting.Lifetime[0]\n"}}
<- (E) {"seq":18,"type":"event","event":"output","body":{"category":"stdout","output":" Application started. Press Ctrl+C to shut down.\n"}}
<- (E) {"seq":19,"type":"event","event":"output","body":{"category":"stdout","output":"\u001B[40m\u001B[32minfo\u001B[39m\u001B[22m\u001B[49m: Microsoft.Hosting.Lifetime[0]\n"}}
<- (E) {"seq":20,"type":"event","event":"output","body":{"category":"stdout","output":" Hosting environment: Development\n"}}
<- (E) {"seq":21,"type":"event","event":"output","body":{"category":"stdout","output":"\u001B[40m\u001B[32minfo\u001B[39m\u001B[22m\u001B[49m: Microsoft.Hosting.Lifetime[0]\n"}}
<- (E) {"seq":22,"type":"event","event":"output","body":{"category":"stdout","output":" Content root path: /[path]/[to]/[project]/demo\n"}}

Is this what you were referring to as the 'full method'?

@gregg-miskelly gregg-miskelly changed the title Unable to debug .NET Core 3.1 projects on Arch Debugger silently fails to connect to target process on Arch May 13, 2020
@gregg-miskelly
Copy link
Contributor

Thanks. That makes way more sense. What I believe is going on is that inter process communications between the .NET Debugging services (which run in the debugger process) and the .NET Runtime (which runs in your app) is silently failing. So the result is that the debugger is never told that the .NET Runtime loaded, and nothing will work.

Unfortunately, since the failure is silent, there is nothing in the log to explain what is going on. One thing you could try -- try attaching to an already running process, and see if we get an error that way. You will probably need to check the logs as VS Code has a bug (that was just fixed in Insiders) where they weren't displaying errors from the configurationDone request.

@bDarbonne
Copy link
Author

bDarbonne commented May 13, 2020

Ok. I ran the project and attached to the process to begin debugging. Nothing seemed to stand out. Here's what I have:
output.txt

@gregg-miskelly
Copy link
Contributor

Interesting. So in case it isn't obvious what happened there: everything worked just fine when you attached.

This means either:

  1. Somehow the debugger is debugging the wrong process in the 'launch' case.
    -or-
  2. The IPC for raising the 'runtime loaded' event is broken, but all the other IPC is working fine.

To try and differentiate the two, if you look at a trace when you do the launch, you will see a process event like the following, which indicates the process the debugger is attached to:

{"seq":8,"type":"event","event":"process","body":{"name":"/[path]/[to]/[project]/demo/bin/Debug/netcoreapp3.1/demo.dll","systemProcessId":4951,"isLocalProcess":true,"startMethod":null}}

Does the process id reported from that event match the process where your code is loaded?

@bDarbonne
Copy link
Author

The process id does match.

@gregg-miskelly
Copy link
Contributor

Hmm... unfortunately the .NET Runtime code isn't the easiest to troubleshoot. If you feel up for it, I can tell you what repo to build, .so to patch and where you could set breakpoints to try and figure this out.

@bDarbonne
Copy link
Author

Sure!

@gregg-miskelly
Copy link
Contributor

Okay, so here is the interesting code that gets loaded into the debugger's process: libdbgshim.so!PAL_RuntimeStartupHelper::Register

If you want to debug into this, you should be able to by:

  1. git clone https://github.com/dotnet/coreclr.git <insert-dest-dir-here> -b release/3.1
  2. cd to your enlistment
  3. build.sh skiptests skipmscorlib skipbuildpackages (I am figuring out this from memory and looking at the usage, so you may need to tweak this)

And then copy the libdbgshim.so that you built into the C# extension's debugger directory. Now you can launch vsdbg-ui under a native debugger (ex: use the VS Code C++ extension, or GDB by hand) in server mode (the same thing you did for logging) and be able to debug things.

After the target process starts, it should attempt to open that semaphore and signal it. Debugging that code is a bit harder. But if you want to read it look at PAL_NotifyRuntimeStarted. That code will be in libcoreclr.so.

@paulsebeikin
Copy link

thanks @gregg-miskelly your advice resolved my issue.

@bDarbonne
Copy link
Author

Thank you @gregg-miskelly! Funny thing happened. I followed your instructions. Ran the project with ./vsdbg-ui --server --consoleLogging one final time (with the generated libdbgshim.so) before trying to debug as suggested... The breakpoints work now. Decided to swap out the .so file for the original just for kicks and giggles. It's working just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants