Repository navigation
fix: Rerun of a DAP debug session that still runs saves the documents where it can, instead of reporting "Write-unsafe context" - #2397
Merged
lagergren merged 1 commit intoDec 1, 2026
Conversation
… where it can, instead of reporting "Write-unsafe context" DAPDebugRunner.execute saved the documents first. Rerun of a session that still runs stops it, waits until its process has ended, and runs the configuration again from an alarm, which isn't write-safe: saving there reported "Write-unsafe context", and failed the run in tests. The runner now saves at once where writing is allowed, and otherwise in a write-safe invokeLater, before the run starts. Fixes redhat-developer#2396
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2397 +/- ##
==========================================
- Coverage 59.82% 59.80% -0.02%
==========================================
Files 860 860
Lines 37690 37701 +11
Branches 5919 7810 +1891
==========================================
Hits 22547 22547
- Misses 12051 12071 +20
+ Partials 3092 3083 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@coderabbitai review |
Action not completed
|
Collaborator
Author
|
@coderabbitai review |
Action performed
|
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.
Fixes #2396.
Cause
DAPDebugRunner.executecallsFileDocumentManager.saveAllDocuments()before the run, as the program may read the files. IntelliJ's execution classes don't save them on that path.ExecutionManagerImpl.restartRunProfilestops the session, waits until its process has ended, and runs the configuration again from an alarm. That isn't a write-safe context, soTransactionGuardreported "Write-unsafe context" at the save.Fix
invokeLaterwithModalityState.nonModal(), which is write-safe, and starts the run after the save. The promise it returns follows that run, or fails with its error.execute, the installation path included, is nowexecuteSaved.Tests
DAPRerunTest:ExecutionUtil.restartwith the session's descriptor as the content to reuse;Without the fix, it fails with "Error running 'rerun': Write-unsafe context!".
Whole suite: 2,861 tests, 0 failures, 7 skipped.
2026.3: the DAP run tests pass, 5 tests.