Skip to content

Conversation

@pitylend
Copy link

Problem

The startDebugging method in debuggingExecutor.ts assumes all coreclr configurations have a program property. However, attach configurations use processName or processId instead of program.

This causes the extension to crash with:

Cannot read properties of undefined (reading 'replace')

When trying to use attach configurations like:

{
    "name": "Attach to Process",
    "type": "coreclr",
    "request": "attach",
    "processName": "MyApp.exe"
}

Solution

Added a check for config.request !== 'attach' to skip the special coreclr test handling for attach configurations. This allows attach configurations to correctly use vscode.debug.startDebugging().

Testing

  • Tested with attach configurations for .NET Service Fabric services
  • Verified launch configurations still work as expected
  • Successfully attached to running processes using processName parameter

Changes

  • src/debuggingExecutor.ts: Added condition to exclude attach requests from special coreclr handling
The startDebugging method previously assumed all coreclr configurations
have a 'program' property. However, attach configurations use
'processName' or 'processId' instead, causing the extension to crash
with "Cannot read properties of undefined (reading 'replace')" when
trying to attach to a running process.

This fix adds a check for `config.request !== 'attach'` to skip the
special coreclr test handling for attach configurations, allowing them
to work correctly with vscode.debug.startDebugging().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant