Skip to content

Remotely debugging .NET 7 apps in linux-arm environments causes segmentation fault #81921

@CamSoper

Description

@CamSoper

Description

Unable to remotely debug .NET 7 apps in linux-arm (32-bit).

Reproduction Steps

  1. Create new .NET 7 console project.
  2. Replace the contents of Program.cs with:
Console.WriteLine("I'm not going to do anything!");
while(true)
{
    System.Threading.Thread.Sleep(1000);
}
  1. Publish the self-contained app with dotnet publish --runtime linux-arm --self-contained and deploy the files to the device as described here.
  2. Ensure the device has vsdbg installed: curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg
  3. From a PC, use the following VS Code launch.json configuration to remotely launch the app in the debugger:
{
  "name": "Remote Launch Pi",
  "type": "coreclr",
  "request": "launch",
  "program": "~/myapp/myapp",
  "args": [],
  "cwd": "~/myapp",
  "stopAtEntry": false,
  "console": "internalConsole",
  "pipeTransport": {
    "pipeCwd": "${workspaceRoot}",
    "pipeProgram": "ssh",
    "pipeArgs": [
      "pi@raspberrypi"
    ],
    "debuggerPath": "~/vsdbg/vsdbg"
  }
  1. Alternatively, launch the app on the Pi and then attach to the running process from the PC with this configuration:
{
  "name": "Attach Pi",
  "type": "coreclr",
  "request": "attach",
  "processId": "${command:pickRemoteProcess}",
  "pipeTransport": {
  "pipeCwd": "${workspaceRoot}",
  "pipeProgram": "ssh",
  "pipeArgs": [
    "pi@raspberrypi"
  ],
  "debuggerPath": "~/vsdbg/vsdbg"
  }
}

Expected behavior

Application runs and the debugging session proceeds.

Actual behavior

When attempting to launch in the debugger:

Starting: "ssh" [email protected] ~/vsdbg/vsdbg --interpreter=vscode
-------------------------------------------------------------------
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.
-------------------------------------------------------------------
Loaded '/home/pi/Animate/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[3178] Animate' has exited with code 0 (0x0).

If attempting to attach to a running process, the debugger attaches and then after breaking/continuing an indeterminite number of times, exits with Segmentation Fault.

Regression?

This currently works in .NET 6. .NET 7 seems to be the only runtime affected.

Known Workarounds

  • Use a 64-bit OS and target linux-arm64 (when using .NET 7)
  • Use .NET 6 and target linux-arm on a 32-bit OS

Configuration

Isolated to linux-arm. Attempted to repro on linux-x64 and linux-arm64. linux-arm is the only runtime affected.

This behavior has been verified on 2 separate Raspberry Pi 3 devices and one Raspberry Pi 4 device, in both Raspberry Pi OS (32-bit) and Ubuntu (32-bit).

This behavior has been observed in Visual Studio Code (both launching the process and attaching to an existing process) and in Visual Studio (attaching remotely).

Other information

This behavior has been observed by other users.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions