Skip to content

Debug: Silent data loss when stored breakpoints/watch expressions are corrupted #319805

@ishaq2321

Description

@ishaq2321

Problem

In src/vs/workbench/contrib/debug/common/debugStorage.ts, five methods load debug data from storage using JSON.parse(), but all five use empty catch blocks — silently swallowing any parsing or construction errors:

  • loadBreakpoints() — line 83 — Stores user breakpoints
  • loadFunctionBreakpoints() — line 94 — Stores function breakpoints
  • loadExceptionBreakpoints() — line 105 — Stores exception breakpoints
  • loadDataBreakpoints() — line 116 — Stores data breakpoints
  • loadWatchExpressions() — line 127 — Stores watch expressions

If stored data gets corrupted (sync conflicts, disk errors, crash mid-write, or a bug in serialization), every single user breakpoint, function breakpoint, exception breakpoint, data breakpoint, and watch expression is silently dropped with zero indication to the user or developer. The data simply vanishes.

This class already has ILogService injected via the constructor (this.logService), but it is unused in the catch blocks.

Why this matters

Users may lose their entire debugging setup without any notification. This is especially painful for complex debug configurations with many breakpoints. The user has no way to know that their data was corrupted — they'll just see all breakpoints gone and assume they were never set.

Fix

Replace empty catch blocks with this.logService.error() calls that record the failure. This ensures:

  1. The error is visible in the developer console and logs
  2. Users/developers can diagnose why breakpoints disappeared
  3. The behavior is unchanged (returns empty array on failure)
  4. The fix is minimal, low-risk, and uses existing infrastructure

File

src/vs/workbench/contrib/debug/common/debugStorage.ts

Metadata

Metadata

Assignees

Labels

insiders-releasedPatch has been released in VS Code Insiders

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions