dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 671 forks source link

Debugger unable to attach to CoreCLR, error 0x80131c3c #7317

Closed Sh18RW closed 3 months ago

Sh18RW commented 3 months ago

Type: Bug

Issue Description

I use C# extention on arm Mac M1.

Steps to Reproduce

To start the app I need x64 arch. I set for all configurations "targetArchitecture": "x86_64". If I start app without debugging, it will work fine. But with debug it fails.

Expected Behavior

Debugger attachs to the app.

Actual Behavior

Debugger throws in Debug Console Unable to attach to CoreCLR. Unknown Error: 0x80131c3c

Logs

Environment information

VSCode version: 1.91.0 C# Extension: 2.34.12 Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.69afb982 Runtime Environment: OS Name: Mac OS X OS Version: 14.4 OS Platform: Darwin RID: osx-arm64 Base Path: /usr/local/share/dotnet/sdk/8.0.101/ .NET workloads installed: Workload version: 8.0.100-manifests.69afb982 There are no installed workloads to display. Host: Version: 8.0.1 Architecture: arm64 Commit: bf5e279d92 .NET SDKs installed: 6.0.420 [/usr/local/share/dotnet/sdk] 7.0.306 [/usr/local/share/dotnet/sdk] 7.0.314 [/usr/local/share/dotnet/sdk] 8.0.101 [/usr/local/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.28 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.28 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.17 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Other architectures found: x64 [/usr/local/share/dotnet/x64] registered at [/etc/dotnet/install_location_x64] Environment variables: DOTNET_ROOT [/usr/local/share/dotnet] DOTNET_ROOT_ARM [/usr/local/share/dotnet] DOTNET_ROOT_X64 [/usr/local/share/dotnet/x64] global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download
Visual Studio Code Extensions |Extension|Author|Version|Folder Name| |---|---|---|---| |andromeda|EliverLara|1.8.2|eliverlara.andromeda-1.8.2| |ariake-dark|wart|0.2.2|wart.ariake-dark-0.2.2| |cmake|twxs|0.0.17|twxs.cmake-0.0.17| |cmake-tools|ms-vscode|1.18.42|ms-vscode.cmake-tools-1.18.42| |code-spell-checker|streetsidesoftware|3.0.1|streetsidesoftware.code-spell-checker-3.0.1| |code-spell-checker-russian|streetsidesoftware|2.2.2|streetsidesoftware.code-spell-checker-russian-2.2.2| |codesnap|adpyke|1.3.4|adpyke.codesnap-1.3.4| |cotion-theme|pabue|0.0.2|pabue.cotion-theme-0.0.2| |cpptools|ms-vscode|1.20.5|ms-vscode.cpptools-1.20.5-darwin-arm64| |cpptools-extension-pack|ms-vscode|1.3.0|ms-vscode.cpptools-extension-pack-1.3.0| |cpptools-themes|ms-vscode|2.0.0|ms-vscode.cpptools-themes-2.0.0| |csdevkit|ms-dotnettools|1.7.27|ms-dotnettools.csdevkit-1.7.27-darwin-arm64| |csharp|ms-dotnettools|2.34.12|ms-dotnettools.csharp-2.34.12-darwin-arm64| |debugpy|ms-python|2024.6.0|ms-python.debugpy-2024.6.0-darwin-arm64| |discord-vscode|icrawl|5.8.0|icrawl.discord-vscode-5.8.0| |dracula-theme-from-intellij|trinm1709|0.3.0|trinm1709.dracula-theme-from-intellij-0.3.0| |EditorConfig|EditorConfig|0.16.4|editorconfig.editorconfig-0.16.4| |gitlens|eamodio|15.1.0|eamodio.gitlens-15.1.0| |halcyon-vscode|brittanychiang|0.3.0|brittanychiang.halcyon-vscode-0.3.0| |indent-rainbow|oderwat|8.3.1|oderwat.indent-rainbow-8.3.1| |intellicode-api-usage-examples|VisualStudioExptTeam|0.2.8|visualstudioexptteam.intellicode-api-usage-examples-0.2.8| |java|redhat|1.32.0|redhat.java-1.32.0-darwin-arm64| |java-extension-pack-jdk|Pleiades|2024.626.0|pleiades.java-extension-pack-jdk-2024.626.0| |LiveServer|ritwickdey|5.7.9|ritwickdey.liveserver-5.7.9| |material-icon-theme|PKief|5.4.2|pkief.material-icon-theme-5.4.2| |material-product-icons|PKief|1.7.0|pkief.material-product-icons-1.7.0| |msbuild-project-tools|tintoy|0.6.3|tintoy.msbuild-project-tools-0.6.3| |parallels-desktop|ParallelsDesktop|1.2.3|parallelsdesktop.parallels-desktop-1.2.3-darwin-arm64| |python|ms-python|2024.10.0|ms-python.python-2024.10.0-darwin-arm64| |rainbow-csv|mechatroner|3.12.0|mechatroner.rainbow-csv-3.12.0| |remote-containers|ms-vscode-remote|0.375.1|ms-vscode-remote.remote-containers-0.375.1| |remote-explorer|ms-vscode|0.4.3|ms-vscode.remote-explorer-0.4.3| |remote-server|ms-vscode|1.5.2|ms-vscode.remote-server-1.5.2| |theme-darkula|alex-pex|1.0.0|alex-pex.theme-darkula-1.0.0| |todo-tree|Gruntfuggly|0.0.226|gruntfuggly.todo-tree-0.0.226| |trailing-spaces|shardulm94|0.4.1|shardulm94.trailing-spaces-0.4.1| |vscode-boot-dev-pack|vmware|0.2.1|vmware.vscode-boot-dev-pack-0.2.1| |vscode-docker|ms-azuretools|1.29.1|ms-azuretools.vscode-docker-1.29.1| |vscode-dotnet-runtime|ms-dotnettools|2.0.8|ms-dotnettools.vscode-dotnet-runtime-2.0.8| |vscode-gradle|vscjava|3.14.1|vscjava.vscode-gradle-3.14.1| |vscode-icons|vscode-icons-team|12.8.0|vscode-icons-team.vscode-icons-12.8.0| |vscode-java-debug|vscjava|0.58.0|vscjava.vscode-java-debug-0.58.0| |vscode-java-dependency|vscjava|0.23.7|vscjava.vscode-java-dependency-0.23.7| |vscode-java-pack|vscjava|0.27.0|vscjava.vscode-java-pack-0.27.0| |vscode-java-test|vscjava|0.41.1|vscjava.vscode-java-test-0.41.1| |vscode-maven|vscjava|0.44.0|vscjava.vscode-maven-0.44.0| |vscode-pylance|ms-python|2024.7.1|ms-python.vscode-pylance-2024.7.1| |vscode-spring-boot|vmware|1.55.1|vmware.vscode-spring-boot-1.55.1| |vscode-spring-boot-dashboard|vscjava|0.14.0|vscjava.vscode-spring-boot-dashboard-0.14.0| |vscode-spring-initializr|vscjava|0.11.2|vscjava.vscode-spring-initializr-0.11.2| |vscode-xml|redhat|0.27.1|redhat.vscode-xml-0.27.1-darwin-arm64| |vscodeintellicode|VisualStudioExptTeam|1.3.1|visualstudioexptteam.vscodeintellicode-1.3.1| |vscodeintellicode-csharp|ms-dotnettools|2.1.11|ms-dotnettools.vscodeintellicode-csharp-2.1.11-darwin-arm64| |vstuc|visualstudiotoolsforunity|1.0.2|visualstudiotoolsforunity.vstuc-1.0.2|;

Extension version: 2.34.12 VS Code version: Code 1.91.0 (Universal) (ea1445cc7016315d0f5728f8e8b12a45dc0a7286, 2024-07-01T18:54:18.541Z) OS version: Darwin arm64 23.4.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|16, 10, 6| |Memory (System)|16.00GB (3.45GB free)| |Process Argv|--crash-reporter-id 46fd5392-f9da-4af0-ba6e-dcd527cc888c| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelc:31048052 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 legacy_priority:31082724 ```
gregg-miskelly commented 3 months ago

We need to improve the error message here, but what is going on is that the .NET Debugging Services dylib either cannot be found or cannot be loaded (error code CORDBG_E_DEBUG_COMPONENT_MISSING).

How is your app deploying the .NET Runtime that your app is running on? (ex: using the shared framework, a platform-dependent deployment, or singlefile)

Also, in case it is helpful, what does your launch.json configuration look like?

Sh18RW commented 3 months ago

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Client",
            "type": "coreclr"   ,
            "request": "launch",
            "program": "${workspaceFolder}/bin/Content.Client/Content.Client.dll",
            "args": [],
            "console": "internalConsole",
            "stopAtEntry": false,
            "targetArchitecture": "x86_64"
        },
        {
            "name": "Client Attach",
            "type": "coreclr"   ,
            "request": "launch",
            "program": "${workspaceFolder}/bin/Content.Client/Content.Client.dll",
            "args": [],
            "console": "internalConsole",
            "stopAtEntry": false,
            "targetArchitecture": "x86_64"
        },
        {
            "name": "Client (Compatibility renderer)",
            "type": "coreclr",
            "request": "launch",
            "program": "${workspaceFolder}/bin/Content.Client/Content.Client.dll",
            "args": "--cvar display.compat=true",
            "console": "internalConsole",
            "stopAtEntry": false,
            "targetArchitecture": "x86_64"
        },
        {
            "name": "Server",
            "type": "coreclr",
            "request": "launch",
            "program": "${workspaceFolder}/bin/Content.Server/Content.Server.dll",
            "args": [],
            "console": "integratedTerminal",
            "stopAtEntry": false,
            "targetArchitecture": "x86_64"
        },
        {
            "name": "YAML Linter",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build-yaml-linter",
            "program": "${workspaceFolder}/bin/Content.YAMLLinter/Content.YAMLLinter.dll",
            "cwd": "${workspaceFolder}/Content.YAMLLinter",
            "console": "internalConsole",
            "stopAtEntry": false,
            "targetArchitecture": "x86_64"
        }
    ],
    "compounds": [
        {
            "name": "Server/Client",
            "configurations": [
                "Server",
                "Client"
            ],
            "preLaunchTask": "build"
        }
    ]
}
gregg-miskelly commented 3 months ago

How are you obtaining the .NET Runtime that your app is running on? (ex: using the shared framework, a platform-dependent deployment, or singlefile)

Sh18RW commented 3 months ago

It is Shared Framework, as I understand. But it has platform-depend packages. I'm sorry, I don't know much yet .NET

gregg-miskelly commented 3 months ago

Can you tell me how you installed the x64 .NET runtime?

Sh18RW commented 3 months ago

I installed .NET SDK 8 for Intel on official website

gregg-miskelly commented 3 months ago

Thanks. For some reason I got it in my head you were attaching, and even though it should have been obvious from your launch.json, I somehow missed that.

Anyway, the problem is that if you are using targetArchitecture to control what debugger to use, but that option just controls the debugger -- not what architecture your code will actually run under. To make your application actually run in an x64 process, you need to change your program. Documentation for more info: https://github.com/dotnet/vscode-csharp/wiki/Debugging-x64-processes-on-an-arm64-computer

I will try to get this error message fixed.

Sh18RW commented 3 months ago

Oh, thanks for the link!