debug: Log errors when loading stored breakpoints/watch expressions (#319805)#319806
Merged
connor4312 merged 1 commit intoJun 3, 2026
Merged
Conversation
…icrosoft#319805) Five methods in DebugStorage silently swallowed errors during JSON.parse() and object construction — if stored debug data gets corrupted (sync conflicts, disk errors, crash mid-write), all user breakpoints, function breakpoints, exception breakpoints, data breakpoints, and watch expressions are silently dropped with zero indication. Replace empty catch blocks with logService.error() to surface corruption events while maintaining the existing fallback behavior (returning empty arrays). Closes microsoft#319805 Co-authored-by: Muhammad Ishaq Khan <muhammadishaqkhan.2321@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves diagnosability of debug-state restoration by logging errors when persisted debug data (breakpoints/watch expressions) fails to parse from workspace storage.
Changes:
- Added
logService.error(...)logging when JSON parsing of stored debug artifacts fails. - Applied the same logging pattern across multiple stored debug data types (breakpoints, function/exception/data breakpoints, watch expressions).
connor4312
approved these changes
Jun 3, 2026
amunger
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five methods in
DebugStoragesilently swallowed JSON parse and object construction errors with empty catch blocks. If stored debug data gets corrupted, users lose all their breakpoints, function breakpoints, exception breakpoints, data breakpoints, and watch expressions — with zero indication of failure.Problem
In
src/vs/workbench/contrib/debug/common/debugStorage.ts, these five methods had emptycatch (e) { }blocks:loadBreakpoints()loadFunctionBreakpoints()loadExceptionBreakpoints()loadDataBreakpoints()loadWatchExpressions()Corruption scenario: If IndexedDB/localStorage data becomes corrupted due to sync conflicts, disk errors, crash mid-write, or a serialization bug,
JSON.parse()throws — the empty catch drops the exception, the method returns[], and the user is left wondering why all their carefully-set breakpoints just disappeared.Fix
Replace each empty
catch (e) { }withthis.logService.error('message', e). The class already hasILogServiceinjected in its constructor but was not using it in these catch blocks.Why this is the right fix
logServiceis already injected via DI, no new dependenciesloadBreakpointsmethod already passesthis.logServicetonew Breakpoint(), so the infrastructure is already wiredTesting
Closes #319805
Co-authored-by: Muhammad Ishaq Khan muhammadishaqkhan.2321@gmail.com