dotnet / vscode-csharp

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

Unable to attach to CoreCLR. Unknown Error: 0x80131c3c #7377

Closed ShevRuslan closed 1 month ago

ShevRuslan commented 2 months ago

Environment data

dotnet --info output: Version: 8.0.107 Commit: 1bdaef7265 Workload version: 8.0.100-manifests.43c23f91

OS Name: ubuntu OS Version: 24.04 OS Platform: Linux RID: ubuntu.24.04-x64 Base Path: /usr/lib/dotnet/sdk/8.0.107/

Workload version: 8.0.100-manifests.43c23f91

Host: Version: 8.0.7 Architecture: x64 Commit: 2aade6beb0

.NET SDKs installed: 8.0.107 [/usr/lib/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.32 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.7 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.32 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.7 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

VS Code version: 1.91.1

C# Extension version: C# v2.34.12 C# Dev Kit v1.9.8 (pre-release)

OmniSharp log

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

Additional context

Add any other context about the problem here.

When launching a traditional console application, an error occurs: Unable to attach to CoreCLR. Unknown Error: 0x80131c3c

ShevRuslan commented 2 months ago

I saw other problems, I tried - nothing helps, I can’t start the application with debugg

gregg-miskelly commented 2 months ago

0x80131C3C = CORDBG_E_DEBUG_COMPONENT_MISSING. The debugger definitely needs some improvements in showing this error, but the underlying problem is that the debugger was unable to load the .NET Debugging services libraries. These are the .so files which need to be next to the version of libcoreclr.so that your app is using.

Questions:

  1. How is your app loading the .NET Runtime? -- using the shared framework (the normal way if you aren't doing anything special in your project), by publishing as a self-contained app, or by publishing as a single file app
  2. What version of the .NET Runtime are you using?
  3. How did you install the .NET SDK (ex: apt get? Microsoft or Ubuntu packages?)
ShevRuslan commented 2 months ago

0x80131C3C = CORDBG_E_DEBUG_COMPONENT_MISSING. The debugger definitely needs some improvements in showing this error, but the underlying problem is that the debugger was unable to load the .NET Debugging services libraries. These are the .so files which need to be next to the version of libcoreclr.so that your app is using.

Questions:

  1. How is your app loading the .NET Runtime? -- using the shared framework (the normal way if you aren't doing anything special in your project), by publishing as a self-contained app, or by publishing as a single file app
  2. What version of the .NET Runtime are you using?
  3. How did you install the .NET SDK (ex: apt get? Microsoft or Ubuntu packages?)

Hello! 1) I have a C# project that is built into the Extensions folder, after which it launches an executable file with a debugger, which creates a local web server and loads modules from Extensions. It is this that cannot be launched with debug. There are no such problems on Windows. 2) .net 6.0 and .net 8.0 3) Via https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?pivots=os-linux-ubuntu-2404&tabs=dotnet8

If you need anything else, tell me)

ShevRuslan commented 2 months ago

0x80131C3C = CORDBG_E_DEBUG_COMPONENT_MISSING. The debugger definitely needs some improvements in showing this error, but the underlying problem is that the debugger was unable to load the .NET Debugging services libraries. These are the .so files which need to be next to the version of libcoreclr.so that your app is using.

Questions:

  1. How is your app loading the .NET Runtime? -- using the shared framework (the normal way if you aren't doing anything special in your project), by publishing as a self-contained app, or by publishing as a single file app
  2. What version of the .NET Runtime are you using?
  3. How did you install the .NET SDK (ex: apt get? Microsoft or Ubuntu packages?)

I also saw and tried a issue to another problem. Change LB_LIBRARY_PATH Rename two .so files and so on - unfortunately nothing helped

gregg-miskelly commented 2 months ago

Can you add the following code to the start of your program and see what it prints?

        string coreLibPath = typeof(object).Assembly.Location;
        if (string.IsNullOrEmpty(coreLibPath) || !System.IO.Path.IsPathFullyQualified(coreLibPath))
        {
            Console.WriteLine("CoreLib is not in a rooted path ('{0}')", coreLibPath);
        }
        else
        {
            string? dotnetRuntimeDirectory = System.IO.Path.GetDirectoryName(coreLibPath);
            if (dotnetRuntimeDirectory is null)
            {
                Console.WriteLine(".NET Runtime directory is null");
            }
            else
            {
                string dbiPath = System.IO.Path.Combine(dotnetRuntimeDirectory, "libmscordbi.so");
                string dacPath = System.IO.Path.Combine(dotnetRuntimeDirectory, "libmscordaccore.so");
                if (!File.Exists(dbiPath))
                {
                    Console.WriteLine("DBI not found at '{0}'", dbiPath);
                }
                else if (!File.Exists(dacPath))
                {
                    Console.WriteLine("DAC not found at '{0}'", dacPath);
                }
                else
                {
                    Console.WriteLine("DBI and DAC found");
                }
            }
        }
ShevRuslan commented 2 months ago

Yes, okay, I’ll do it and write within 2-3 days, I can’t at the moment, thank you!

ShevRuslan commented 2 months ago

I would like to know right away - do you mean launch after build, without any trouble, i.e. release module?

gregg-miskelly commented 2 months ago

Use whatever configuration you are trying to debug, which I am assuming is Debug? Just use 'Run->Run Without Debugging' instead of 'Run->Start Debugging' from the VS Code menu (or whatever equivalent gesture if you are starting debugging in a different way).

ShevRuslan commented 2 months ago

Okay, I got it, I'll check it in the next few days and write here, thanks!

gregg-miskelly commented 2 months ago

FYI As part of adding a better error message here, I wrote up full troubleshooting instructions: https://github.com/dotnet/vscode-csharp/wiki/Troubleshoot-loading-the-.NET-Debug-Services

gregg-miskelly commented 1 month ago

I am going to close this for now. Feel free to ping back and I will reopen if you want to investigate further.