Skip to content

.NET 5 linux-arm: Unable to attach to CoreCLR. Unknown Error: 0x80131c4f #4210

@profix898

Description

@profix898

Issue Description

I'm trying to build a simple console project in VS Code on Win 10 x64 using the .NET 5 (5.0.100) SDK. When deploying and executing the program remotely on a Raspberry Pi 4 using the 'vsdbg'-Debugger the debugger fails with the following error: Unable to attach to CoreCLR. Unknown Error: 0x80131c4f.

Steps to Reproduce

  1. I have created a minimal console project with the following content:

RPiDemo.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
</Project>

Program.cs

using System;

namespace RPiDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello RPi!");
        }
    }
}

The project is successfully compiled in VS Code on Win 10 x64 using the locally installed .NET 5 SDK. The project is published for 'linux-arm' and copied to the Raspberry Pi 4 (with Raspian 10, latest version as of today) with the following command:

dotnet publish -c Release -r linux-arm -o ./publish/linux-arm ${workspaceFolder} ; scp -rp -P 2222 ./publish/linux-arm/ root@192.168.81.129:/opt/RPiDemo

I'm essentially following the instructions at https://github.com/OmniSharp/omnisharp-vscode/wiki/Remote-Debugging-On-Linux-Arm (or similar tutorials on the internet).

The project is then launched on the RPi with the 'vsdbg' remote debugger. My launch.json looks like this:

{
    "configurations": [        
        {
            "name": "Launch LOCAL",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/bin/Debug/net5.0/RPiDemo.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            "console": "internalConsole"
        }, 
        {
            "name": "Launch REMOTE",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "BuildPublishCopyLinuxARM",
            "program": "/usr/bin/dotnet",
            "args": [
                "/opt/RPiDemo/RPiDemo.dll"
            ],
            "cwd": "/opt/RPiDemo",
            "stopAtEntry": false,
            "console": "internalConsole",
            "pipeTransport": {
                "pipeCwd": "${workspaceRoot}",
                "pipeProgram": "ssh",
                "pipeArgs": [
                    "-T",
                    "-p", "2222",
                    "root@192.168.81.129"
                ],
                "quoteArgs": true,
                "debuggerPath": "/usr/bin/vsdbg/vsdbg"
            },
            "logging": {
                "engineLogging": true,
                "programOutput": true,
                "exceptions": true
            }
        },
    ]
}

Expected Behavior

Debugger should launch and attach to the process on the RPi and provide debug information to VS Code.

Actual Behavior

Debugger prints the following error message: Unable to attach to CoreCLR. Unknown Error: 0x80131c4f.
I have then enabled logging via "engineLogging": true, to obtain more details (as shown in the log below).

I'd like to note, that the console project works perfectly both locally on the Win 10 x64 host and also when being launched manually on the RPi via the dotnet RPiDemo.dll command (directly in the published directory '/opt/RPiDemo').

Logs

OmniSharp log

DetailsStarting: "ssh" -T -p 2222 root@192.168.81.129 "/usr/bin/vsdbg/vsdbg --interpreter=vscode" -> (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,"supportsInvalidatedEvent":true},"type":"request","seq":1} -> (C) {"command":"launch","arguments":{"name":"Launch REMOTE","type":"coreclr","request":"launch","preLaunchTask":"BuildPublishCopyLinuxARM","program":"/usr/bin/dotnet","args":["/opt/RPiDemo/RPiDemo.dll"],"cwd":"/opt/RPiDemo","stopAtEntry":false,"requireExactSource":false,"console":"internalConsole","pipeTransport":{"pipeCwd":"D:\\Repos\\Demo\\RPiDemo","pipeProgram":"ssh","pipeArgs":["-T","-p","2222","root@192.168.81.129"],"quoteArgs":true,"debuggerPath":"/usr/bin/vsdbg/vsdbg"},"logging":{"engineLogging":false,"programOutput":true,"exceptions":true},"__configurationTarget":5,"internalConsoleOptions":"openOnSessionStart","__sessionId":"7be5a8c7-37ec-4071-b82e-6f72e8fd2038"},"type":"request","seq":2} <- (E) {"seq":2,"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","severity":"ok"}} ------------------------------------------------------------------- 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. ------------------------------------------------------------------- <- (R) {"seq":3,"type":"response","request_seq":2,"success":true,"command":"launch"} <- (E) {"seq":4,"type":"event","event":"initialized","body":{}} -> (C) {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":3} <- (R) {"seq":5,"type":"response","request_seq":3,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}} -> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":["user-unhandled"]},"type":"request","seq":4} <- (R) {"seq":6,"type":"response","request_seq":4,"success":true,"command":"setExceptionBreakpoints"} -> (C) {"command":"configurationDone","type":"request","seq":5} <- (E) {"seq":7,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/ProcessCreate","data":{"VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"10","VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"b7159782","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"16.8.11013.1 commit:4b0f186e434a6a8e833baeddc7bd2fad8dd08f41"}}} <- (E) {"seq":8,"type":"event","event":"process","body":{"name":"/usr/bin/dotnet","systemProcessId":1420,"isLocalProcess":false,"startMethod":"launch"}} <- (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.Launch.Duration":180,"VS.Diagnostics.Debugger.vsdbg.VisualizerFileUsed":false,"VS.Diagnostics.Debugger.vsdbg.TargetType":"Live","VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"10","VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"b7159782","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.SourceFileMappings":0,"VS.Diagnostics.Debugger.vsdbg.Version":"16.8.11013.1 commit:4b0f186e434a6a8e833baeddc7bd2fad8dd08f41"}}} <- (R) {"seq":10,"type":"response","request_seq":5,"success":true,"command":"configurationDone"} -> (C) {"command":"threads","type":"request","seq":6} <- (R) {"seq":11,"type":"response","request_seq":6,"success":true,"command":"threads","body":{"threads":[]}} <- (E) {"seq":12,"type":"event","event":"output","body":{"category":"stderr","output":"Unable to attach to CoreCLR. Unknown Error: 0x80131c4f","severity":"error"}} Unable to attach to CoreCLR. Unknown Error: 0x80131c4f

Environment information

VSCode version: 1.51.1
C# Extension: 1.23.6

Dotnet Information .NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7

.NET SDKs installed:
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.207 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

Visual Studio Code Extensions
Extension Author Version
code-runner formulahendry 0.11.1
cpptools ms-vscode 1.1.1
csharp ms-dotnettools 1.23.6
EditorConfig EditorConfig 0.15.1
gitlens eamodio 11.0.1
Ionide-fsharp Ionide 4.17.0
jupyter ms-toolsai 2020.11.358541065
markdown-all-in-one yzhang 3.4.0
path-intellisense christian-kohler 2.3.0
powershell ms-vscode 2020.6.0
python ms-python 2020.11.358366026
remote-containers ms-vscode-remote 0.148.1
remote-ssh ms-vscode-remote 0.56.0
remote-ssh-edit ms-vscode-remote 0.56.0
remote-wsl ms-vscode-remote 0.51.3
resourcemonitor mutantdino 1.0.7
vscode-icons vscode-icons-team 11.0.0
vsliveshare ms-vsliveshare 1.0.3121
xml DotJoshJohnson 2.5.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions