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

[Regression] A new CMake Debugger instance will generate after running "CMake: Configure with CMake Debugger" for the second time #4230

Open
Amy-Li03 opened this issue Jan 9, 2025 · 1 comment · May be fixed by #4242
Assignees
Labels
bug a bug in the product Feature: CMake Debugger regression used to work and no longer does. Regressions are typically high priority
Milestone

Comments

@Amy-Li03
Copy link
Collaborator

Amy-Li03 commented Jan 9, 2025

Brief Issue Summary

Environment:

VS Code 1.96.2 + CMake Tools v1.20.34 (pre-release)

More info:

  1. This issue doesn't repro on v1.19.16(pre-release), it starts repro from v1.19.17(pre-release) to latest version v1.20.34(pre-release), so it is a regression issue
  2. This issue reproduces on Windows, Linux, and Mac platforms

Repro steps:

  1. Unzip the project and open it with vscode.CMakeProject1.zip
  2. Set a breakpoint on line12: "project("CMakeProject1")"
  3. Open the command palette (F1 or Ctrl+Shift+P)
  4. Enter and select the command “CMake: Configure with CMake Debugger”
  5. Open the command palette (F1 or Ctrl+Shift+P)
  6. Enter and select the command “CMake: Configure with CMake Debugger” once more
  7. Observe the CMake Debugger instance in Call Stack window

Actual result:

After step4, the breakpoint will be hit. - correct
After step7, a new CMake Debugger instance will generate, and we cannot stop it. - incorrect
Image

Expected result:

After step4, the breakpoint will be hit.
After step7, no new CMake Debugger instance generate.
Image

CMake Tools Diagnostics

Debug Log

Additional Information

No response

@github-project-automation github-project-automation bot moved this to Blocked in CMake Tools Jan 9, 2025
@Amy-Li03 Amy-Li03 added the bug a bug in the product label Jan 9, 2025
@github-actions github-actions bot added the triage label Jan 9, 2025
@Amy-Li03 Amy-Li03 added regression used to work and no longer does. Regressions are typically high priority Feature: CMake Debugger and removed triage labels Jan 9, 2025
@gcampbell-msft gcampbell-msft moved this from Blocked to Pending Prioritization in CMake Tools Jan 14, 2025
@gcampbell-msft gcampbell-msft added this to the 1.20 milestone Jan 14, 2025
@gcampbell-msft gcampbell-msft self-assigned this Jan 14, 2025
@gcampbell-msft gcampbell-msft moved this from Pending Prioritization to To Do in CMake Tools Jan 14, 2025
@gcampbell-msft
Copy link
Collaborator

gcampbell-msft commented Jan 14, 2025

Did some initial investigation.

The issue here is stemming from the fact that we are using vscode.debug.startDebugging as the entry point for the commands to configure with CMake debugger. This works as expected in nearly all cases except for this one.

The reason it doesn't work as expected in this one, is because we return early out of the configure methods due to already being in a configure. When we return early, we don't resolved the debuggerReady promise, and therefore we end up spinning in the DebugAdapterNamedPipeServerDescriptorFactory createDebugAdapterDescriptor waiting for the debugAdapterDescriptor.

We will likely need a slight refactor, or we need to be okay with adding another promise that we can wait with Promise.race, and when the cancelled one finishes first, it will error out with a popup saying that we weren't able to connect to it.

The simplest fix is likely to deal with the fact that there will be a modal popup, since this is hopefully a rare scenario, and when it happens, it would be confusing if users didn't get an obvious pop-up telling them why we weren't able to configure. This is my suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the product Feature: CMake Debugger regression used to work and no longer does. Regressions are typically high priority
Projects
Status: In Progress
2 participants