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

Failed command 'configurationDone':0x80131c3c #111

Closed
akorchev opened this issue Feb 28, 2023 · 11 comments
Closed

Failed command 'configurationDone':0x80131c3c #111

akorchev opened this issue Feb 28, 2023 · 11 comments

Comments

@akorchev
Copy link

Hi,

I have a weird issue which I don't know how to solve. It happens on a user machine (MacBook Pro, M1) which is identical to mine where this error doesn't happen. Debugging fails with 0x80131c3c which according to another issue indicates that dbgshim fails to load. Here is the complete log:

[2023-02-28 07:41:09.267] [info]  [DebugAdapterClient] sending request 'initialize' (5) {
  "adapterID": ""
}
[2023-02-28 07:41:09.271] [info]  [DebugAdapterClient] Received event 'capabilities' (1) {
  "body": {
    "capabilities": {
      "exceptionBreakpointFilters": [
        {
          "filter": "user-unhandled",
          "label": "user-unhandled"
        },
        {
          "filter": "all",
          "label": "all"
        }
      ],
      "supportTerminateDebuggee": true,
      "supportsCancelRequest": true,
      "supportsConditionalBreakpoints": true,
      "supportsConfigurationDoneRequest": true,
      "supportsExceptionFilterOptions": true,
      "supportsExceptionInfoRequest": true,
      "supportsExceptionOptions": false,
      "supportsFunctionBreakpoints": true,
      "supportsSetExpression": true,
      "supportsSetVariable": true,
      "supportsTerminateRequest": true
    }
  },
  "event": "capabilities",
  "seq": "1",
  "type": "event"
}
[2023-02-28 07:41:09.272] [info]  [DebugAdapterClient] Received event 'initialized' (2) {
  "body": {},
  "event": "initialized",
  "seq": "2",
  "type": "event"
}
[2023-02-28 07:41:09.272] [info]  [DebugAdapterClient] received response for 'initialize' (5) {
  "body": {
    "exceptionBreakpointFilters": [
      {
        "filter": "user-unhandled",
        "label": "user-unhandled"
      },
      {
        "filter": "all",
        "label": "all"
      }
    ],
    "supportTerminateDebuggee": true,
    "supportsCancelRequest": true,
    "supportsConditionalBreakpoints": true,
    "supportsConfigurationDoneRequest": true,
    "supportsExceptionFilterOptions": true,
    "supportsExceptionInfoRequest": true,
    "supportsExceptionOptions": false,
    "supportsFunctionBreakpoints": true,
    "supportsSetExpression": true,
    "supportsSetVariable": true,
    "supportsTerminateRequest": true
  },
  "command": "initialize",
  "request_seq": 5,
  "seq": "3",
  "success": true,
  "type": "response"
}
[2023-02-28 07:41:09.272] [info]  [DebugAdapterClient] sending request 'attach' (6) {
  "processId": 2789
}
[2023-02-28 07:41:09.272] [info]  [DebugAdapterClient] received response for 'attach' (6) {
  "body": {},
  "command": "attach",
  "request_seq": 6,
  "seq": "4",
  "success": true,
  "type": "response"
}
[2023-02-28 07:41:09.273] [info]  [DebugAdapterClient] sending request 'configurationDone' (7)
[2023-02-28 07:41:09.412] [info]  [DebugAdapterClient] received error response for 'configurationDone' (7) {
  "command": "configurationDone",
  "message": "Failed command 'configurationDone' : 0x80131c3c",
  "request_seq": 7,
  "seq": "5",
  "success": false,
  "type": "response"
}

Some background. I have successfully built netcoredbg for Mac M1 by following #103 - everything works fine on three different M1 macs that I have access to. I am sure I am bundling libdbgshim.dylib from the DbgShim nuget package (using the latest version 7.0.410101). I have also requested the user to show me the log of dotnet --info and it seems he has the arm64 version of .NET framework 7 installed. Everything is exactly the same as my system - macOS version, .NET version etc. Does this error happen in cases that are different than dbgshim mismatch? Any other tips how to troubleshoot this further?

@gbalykov
Copy link
Member

How do you launch netcoredbg? Do you use it from some IDE?

@akorchev
Copy link
Author

akorchev commented Feb 28, 2023

Yes, it is an IDE that we make. We launch netcoredbg as a process (netcoredbg --interpreter=vscode) and send DAP commands. Works in every other case so launching shouldn't be the cause of the problem.

Here is the actual code that we use to start a debug session after netcoredbg has launched (TypeScript):

  await serverDebugger.initialize({ adapterID: ''});
  await serverDebugger.attach({processId});
  await serverDebugger.configurationDone();

This code is a thin wrapper that sends DAP requests.

@viewizard
Copy link
Member

viewizard commented Feb 28, 2023

Looks like you have same issue - #98

@gbalykov
Copy link
Member

@akorchev check that all libraries and binaries (e.g. dotnet sdk, dbgshim, netcoredbg) that you use are for osx-arm64, not osx-amd64. Looks like you have some osx-amd64 lib. See #98 (comment) for more details.

@akorchev
Copy link
Author

akorchev commented Feb 28, 2023

@viewizard yes, the error message is the same however I have built netcoredbg for macos arm64 and have it running on multiple machines without issues. It is only one user (so far) that is reporting this problem on identical configuration.

@gbalykov I have tripple checked that - the dbgshim and netcoredbg are for arm64. Here is the output of the file command.

file ./libdbgshim.dylib 
./libdbgshim.dylib: Mach-O 64-bit dynamically linked shared library arm64
file ./netcoredbg 
./netcoredbg: Mach-O 64-bit executable arm64

The only thing I don't have control over is the installed .NET framework. However dotnet --info reports correctly that our user has arm64 installed.

dotnet --info
.NET SDK:
 Version:   7.0.200
 Commit:    534117727b

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.2
 OS Platform: Darwin
 RID:         osx.13-arm64
 Base Path:   /usr/local/share/dotnet/sdk/7.0.200/

Host:
  Version:      7.0.3
  Architecture: arm64
  Commit:       0a2bda10e8

.NET SDKs installed:
  6.0.100 [/usr/local/share/dotnet/sdk]
  6.0.300 [/usr/local/share/dotnet/sdk]
  6.0.302 [/usr/local/share/dotnet/sdk]
  6.0.400 [/usr/local/share/dotnet/sdk]
  6.0.401 [/usr/local/share/dotnet/sdk]
  6.0.402 [/usr/local/share/dotnet/sdk]
  6.0.403 [/usr/local/share/dotnet/sdk]
  6.0.404 [/usr/local/share/dotnet/sdk]
  6.0.405 [/usr/local/share/dotnet/sdk]
  6.0.406 [/usr/local/share/dotnet/sdk]
  7.0.100 [/usr/local/share/dotnet/sdk]
  7.0.101 [/usr/local/share/dotnet/sdk]
  7.0.102 [/usr/local/share/dotnet/sdk]
  7.0.103 [/usr/local/share/dotnet/sdk]
  7.0.200 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

To me it seems that everything is arm64. Do you see any issues? Is there any way I can get a more detailed error message than 0x80131c3c?

@gbalykov
Copy link
Member

How are apps launched? Can 6.0 osx-amd64 sdk be used for some reason?

@akorchev
Copy link
Author

I am launching the app with dotnet run and then attach to the process id. In theory there is a chance dotnet somehow uses a different SDK however such should not be installed on the user's machine. I will try to verify that with the user.

@akorchev
Copy link
Author

I asked the user to add this code to their app (which is started with dotnet run and then debugged)

Console.WriteLine($".NET {Environment.Version} {System.Runtime.InteropServices.RuntimeInformation.OSDescription} {System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture}");

The output he got was this:

.NET 7.0.3 Darwin 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000 Arm64

which makes me think the .NET SDK being used is for arm64.

Anything else I could try? Some more detailed logging that I could enable in netcoredbg ?

@gbalykov
Copy link
Member

You can try smth like strace to track all loaded libraries, but not sure whether it's available for mac or not.

@akorchev
Copy link
Author

The error seems to be CORDBG_E_DEBUG_COMPONENT_MISSING which means libmscordbi.dylib or libmscordaccore.dylib can't be found or loaded. Do you know if some environment variable could interfere with finding those files?

@akorchev
Copy link
Author

akorchev commented Mar 7, 2023

After a lot of trial and error it turned out to be an issue caused by the macOS hardened runtime. Loading libraries requires this to be included in the plist when signing your application:

    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>

Hopefully this would help someone.

@akorchev akorchev closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants