vscode-csharp: Can't attach debugger when running on Cloud Foundry

Environment data

.NET Core SDK (reflecting any global.json): Version: 2.1.402 Commit: 7fa21d645b

Runtime Environment: OS Name: ubuntu OS Version: 14.04 OS Platform: Linux RID: ubuntu.14.04-x64 Base Path: /home/vcap/deps/0/dotnet-sdk/sdk/2.1.402/

Host (useful for support): Version: 2.1.4 Commit: 85255dde3e

.NET Core SDKs installed: 2.1.402 [/home/vcap/deps/0/dotnet-sdk/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.4 [/home/vcap/deps/0/dotnet-sdk/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.4 [/home/vcap/deps/0/dotnet-sdk/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.4 [/home/vcap/deps/0/dotnet-sdk/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download VS Code version: 1.28.1 C# Extension version: 1.16.2

Steps to reproduce

Use any Cloud Foundry foundation (PAS). The easiest way to test is to get PWS account at run.pivotal.io

  1. Install CF CLI https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
  2. Login to PCF cf login -a api.run.pivotal.io
  3. Publish any .net core 2.1 app dotnet publish
  4. CD into the publish folder and push on to the platform cf push myappname
  5. Install vsdbg into container 5.1. cf ssh myappname 5.2 curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg
  6. Create launch file as per following
{
  "name": ".NET Core Remote Attach",
  "configurations": [
    {
      "name": ".NET Core Attach",
      "type": "coreclr",
      "request": "attach",
      "processName": "dotnet",
      "pipeTransport": {
        "pipeCwd": "${workspaceFolder}",
        "pipeProgram": "c:\\tools\\putty\\plink.exe",
        "pipeArgs": [ 
          "-l", "cf:7d051231-35d7-4e2b-941c-0b02ca385909/0", 
          "-pw", "TNt2bUZbxr", 
          "ssh.run.pivotal.io",
          "-P", "2222", 
          "-hostkey", "e7:13:4e:32:ee:39:62:df:54:41:d7:f7:8b:b2:a7:6b",
          "-batch",
          "-T" ],
        "logging": {
            "engineLogging": true
        },
        "debuggerPath": "~/vsdbg/vsdbg"
      }
    }
  ],
  
}

6.1. Adjust pipeProgram to point to plink (part of putty package) 6.2. Use cf app myappname --guid and use output to fix up pipeArgs for username -l parameter “cf:7d051231-35d7-4e2b-941c-0b02ca385909/0”. Guid is in middle, prefix must be cf: and sufix /0 6.3. Get one time ssh password cf ssh-code and plug it into launchArgs for -pw arg

Expected behavior

Debugger attaches successfully

Actual behavior

Failed to debug. See output below (captured out of Visual Studio, but result is the same in VS Code as well)

<- (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"}}
-------------------------------------------------------------------
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":4,"type":"response","request_seq":2,"success":true,"command":"attach"}
<- (E) {"seq":6,"type":"event","event":"initialized","body":{}}
-> (C) {"request_seq":1,"success":true,"command":"handshake","body":{"signature":"0501Nv6+lxTvkiufXJnmv4i2am/48NQ+jl8FCBa0LaQybs="},"seq":3,"type":"response"}
-> (C) {"command":"setDebuggerProperty","arguments":{"DisableJITOptimization":0},"seq":4,"type":"request"}
<- (R) {"seq":10,"type":"response","request_seq":4,"success":true,"command":"setDebuggerProperty","message":"","body":{}}
-> (C) {"command":"setDebuggerProperty","arguments":{"InterpreterOptions":1},"seq":5,"type":"request"}
<- (R) {"seq":13,"type":"response","request_seq":5,"success":true,"command":"setDebuggerProperty","message":"","body":{}}
-> (C) {"command":"setDebuggerProperty","arguments":{"JustMyCodeStepping":1},"seq":6,"type":"request"}
<- (R) {"seq":16,"type":"response","request_seq":6,"success":true,"command":"setDebuggerProperty","message":"","body":{}}
-> (C) {"command":"setDebuggerProperty","arguments":{"StopOnExceptionCrossingManagedBoundary":0},"seq":7,"type":"request"}
<- (R) {"seq":19,"type":"response","request_seq":7,"success":true,"command":"setDebuggerProperty","message":"","body":{}}
-> (C) {"command":"setDebuggerProperty","arguments":{"WarnIfNoUserCodeOnLaunch":1},"seq":8,"type":"request"}
<- (R) {"seq":22,"type":"response","request_seq":8,"success":true,"command":"setDebuggerProperty","message":"","body":{}}
-> (C) {"command":"setDebuggerProperty","arguments":{"EnableStepFiltering":true},"seq":9,"type":"request"}
<- (R) {"seq":25,"type":"response","request_seq":9,"success":true,"command":"setDebuggerProperty","message":"","body":{}}
-> (C) {"command":"setSymbolOptions","arguments":{"symbolOptions":{"searchPaths":[""],"cachePath":"","moduleFilter":{"mode":"loadAllButExcluded","excludedModules":[""]}}},"seq":10,"type":"request"}
<- (R) {"seq":28,"type":"response","request_seq":10,"success":true,"command":"setSymbolOptions"}
-> (C) {"command":"setBreakpoints","arguments":{"source":{"path":"c:\\projects\\pcf-ers-dotnetcore-demo\\src\\Controllers\\HomeController.cs","sources":[],"checksums":[{"algorithm":"MD5","checksum":"8f3635ab9d90bad14faecd6d128895fa"},{"algorithm":"MD5","checksum":"a1e50e931fe59c701ecae6588763c49b"},{"algorithm":"SHA1","checksum":"77b2464865d8e40fe836950b9617174259a6db9d"},{"algorithm":"SHA1","checksum":"622107161a66a6686039efca108821c844e43d53"},{"algorithm":"SHA256","checksum":"d18dbd0c70177f1697ffe1bcd9ba4a5887b9099bde39f3cb00da5b88637a92cb"},{"algorithm":"SHA256","checksum":"a47bea88dc719dc6d28ec38d97220b8dadee52eafc02393f3f92d902000a3987"}]},"breakpoints":[{"line":23,"column":13}],"lines":[23]},"seq":11,"type":"request"}
<- (R) {"seq":31,"type":"response","request_seq":11,"success":true,"command":"setBreakpoints","message":"","body":{"breakpoints":[{"id":1,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":23,"column":13}]}}
-> (C) {"command":"setBreakpoints","arguments":{"source":{"path":"c:\\projects\\pcf-ers-dotnetcore-demo\\src\\Controllers\\HomeController.cs","sources":[],"checksums":[{"algorithm":"MD5","checksum":"8f3635ab9d90bad14faecd6d128895fa"},{"algorithm":"MD5","checksum":"a1e50e931fe59c701ecae6588763c49b"},{"algorithm":"SHA1","checksum":"77b2464865d8e40fe836950b9617174259a6db9d"},{"algorithm":"SHA1","checksum":"622107161a66a6686039efca108821c844e43d53"},{"algorithm":"SHA256","checksum":"d18dbd0c70177f1697ffe1bcd9ba4a5887b9099bde39f3cb00da5b88637a92cb"},{"algorithm":"SHA256","checksum":"a47bea88dc719dc6d28ec38d97220b8dadee52eafc02393f3f92d902000a3987"}]},"breakpoints":[{"line":23,"column":13}],"lines":[23]},"seq":12,"type":"request"}
<- (R) {"seq":34,"type":"response","request_seq":12,"success":true,"command":"setBreakpoints","message":"","body":{"breakpoints":[{"id":1,"verified":false,"message":"The breakpoint is pending and will be resolved when debugging starts.","line":23,"column":13}]}}
-> (C) {"command":"setExceptionBreakpoints","arguments":{"filters":[],"exceptionOptions":[{"path":[{"names":["CLR"]}],"breakMode":"userUnhandled"},{"path":[{"names":["CLR"]},{"names":["System.AppDomainUnloadedException","System.Threading.ThreadAbortException"]}],"breakMode":"unhandled"},{"path":[{"names":["CLR"]},{"names":["System.Windows.Markup.XamlParseException","System.Reflection.MissingMetadataException","System.Reflection.MissingRuntimeArtifactException"]}],"breakMode":"always"},{"path":[{"names":["MDA"]}],"breakMode":"unhandled"},{"path":[{"names":["MDA"]},{"names":["CallbackOnCollectedDelegate","ContextSwitchDeadlock","DateTimeInvalidLocalFormat","DisconnectedContext","FatalExecutionEngineError","InvalidFunctionPointerInDelegate","InvalidMemberDeclaration","InvalidVariant","LoaderLock","NonComVisibleBaseClass","PInvokeStackImbalance","RaceOnRCWCleanup","Reentrancy"]}],"breakMode":"always"}]},"seq":13,"type":"request"}
<- (R) {"seq":37,"type":"response","request_seq":13,"success":true,"command":"setExceptionBreakpoints"}
-> (C) {"command":"configurationDone","arguments":{},"seq":14,"type":"request"}
<- (E) {"seq":40,"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/vsdbg/AttachFailed","data":{"VS.Diagnostics.Debugger.vsdbg.ErrorCode":-2146231288,"VS.Diagnostics.Debugger.vsdbg.Distribution.Name":"ubuntu","VS.Diagnostics.Debugger.vsdbg.Distribution.Version":"14.04","VS.Diagnostics.Debugger.vsdbg.OSFamily":"Linux","VS.Diagnostics.Debugger.vsdbg.Version":"15.7.20426.1 commit:91b285752d1135b8cdcdb3d74b44ca9faee48809"}}}
<- (R) {"seq":42,"type":"response","request_seq":14,"success":false,"command":"configurationDone","message":"Failed to attach to process: Unknown Error: 0x80131c08"}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

Ok, I’ve figured out how to do this with VSCode now:

{
    "name": ".NET Core Remote Attach",
    "configurations": [
      {
        "name": ".NET Core Attach",
        "type": "coreclr",
        "request": "attach",
        "processName": "dotnet",
        "pipeTransport": {
          "pipeCwd": "${workspaceFolder}",
          "pipeProgram": "cf",
          "pipeArgs": [
            "ssh", "democore", "-c", "\"/tmp/lifecycle/shell /home/vcap/app 'bash -c \\\"${debuggerCommand}\\\"'\"" ],
          "logging": {
              "engineLogging": true
          },
          "debuggerPath": "~/vsdbg/vsdbg"
        }
      }
    ],
}