Skip to content

Do not open debug view on first session start when openDebug is openOnDebugBreak#309133

Merged
connor4312 merged 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/debug-view-first-session-263434-fix
Apr 13, 2026
Merged

Do not open debug view on first session start when openDebug is openOnDebugBreak#309133
connor4312 merged 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/debug-view-first-session-263434-fix

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

Fixes #263434.

The default debug.openDebug value is openOnDebugBreak, which is documented as opening the debug view when the debugger breaks. However, the view also opened on the very first debug session of a window, regardless of whether a breakpoint was hit.

The previous condition in DebugService.launchOrAttachToSession was:

if (!configuration.resolved.noDebug && (openDebug === 'openOnSessionStart' || (openDebug !== 'neverOpen' && this.viewModel.firstSessionStart)) && !session.suppressDebugView) {

The openDebug !== 'neverOpen' check caused openOnDebugBreak (and any other value) to fall into the first-session-start branch. The fix restricts that branch to the explicit openOnFirstSessionStart value, which is what users expect when reading the setting names.

openOnDebugBreak is still handled separately in debugSession.ts when a thread stops on a breakpoint reason, so behavior on actual breaks is unchanged.

Test plan

  • Set debug.openDebug to openOnDebugBreak (the default), reload the window, and start a debug session that does not hit a breakpoint immediately. The debug view should not auto-open.
  • With the same setting, hit a breakpoint. The debug view should still auto-open.
  • Set debug.openDebug to openOnFirstSessionStart and start a debug session in a fresh window. The debug view should open.
  • Set debug.openDebug to openOnSessionStart and start any debug session. The debug view should open.
  • Set debug.openDebug to neverOpen. The debug view should never auto-open.

…openOnDebugBreak

The previous condition opened the debug viewlet on first session start for
any value of `debug.openDebug` other than `neverOpen`, which contradicts the
`openOnDebugBreak` semantics. With `openOnDebugBreak` (the default), the view
should only be revealed when a breakpoint is actually hit, which is already
handled in `debugSession.ts`.

Restrict the first-session-start branch to `openOnFirstSessionStart` so that
`openOnDebugBreak` no longer forces the view open on initial launch.

Fixes microsoft#263434
@connor4312 connor4312 enabled auto-merge (squash) April 13, 2026 15:09
@connor4312 connor4312 merged commit e9b5201 into microsoft:main Apr 13, 2026
25 of 26 checks passed
@vs-code-engineering vs-code-engineering bot added this to the 1.117.0 milestone Apr 13, 2026
@DanTup
Copy link
Copy Markdown
Contributor

DanTup commented Apr 13, 2026

@yogeshwaran-c thank you! 🙏

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

Successfully merging this pull request may close these issues.

Debug Sidebar is shown when starting first debug session, even when set to openOnDebugBreak

4 participants