Fix ScheduleTimeRecord.AccumulatedTime hang during solution close#13375
Merged
YuliiaKovalova merged 3 commits intomainfrom Mar 13, 2026
Merged
Fix ScheduleTimeRecord.AccumulatedTime hang during solution close#13375YuliiaKovalova merged 3 commits intomainfrom
YuliiaKovalova merged 3 commits intomainfrom
Conversation
ScheduleTimeRecord.AccumulatedTime throws InternalErrorException with 'Can't get the accumulated time while the timer is still running' during Scheduler.WriteDetailedSummary(). This exception kills the BuildManager work queue, preventing any further build results from being processed. EndBuild() hangs indefinitely, causing VS to freeze for hours. The fix returns the best-effort elapsed time (accumulated + current elapsed) when the timer is still running, instead of throwing. This is diagnostic summary data — throwing has no correctness benefit but causes a catastrophic hang. 11 hits in 30 days confirmed via telemetry (StackHash: 2C721D65...). All occurrences during solution close with running timers.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a scheduler diagnostic timing bug that can hang VS during solution close by making ScheduleTimeRecord.AccumulatedTime tolerant of a still-running timer, avoiding an InternalErrorException that can kill the BuildManager work queue thread.
Changes:
- Updated
ScheduleTimeRecord.AccumulatedTimeto return best-effort elapsed time when the timer is still running (instead of throwing). - Added explanatory XML documentation describing the rationale and impact of the behavior change.
- Remove placeholder issues/XXXXX URL from XML doc comment - Add ScheduleTimeRecord_AccumulatedTime_DoesNotThrowWhenTimerIsRunning test - Add ScheduleTimeRecord_AccumulatedTime_IncludesPreviousAccumulation test
rainersigwald
approved these changes
Mar 12, 2026
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
This was referenced Mar 13, 2026
AR-May
pushed a commit
to AR-May/msbuild
that referenced
this pull request
Mar 19, 2026
…tnet#13375) ## Bug `ScheduleTimeRecord.get_AccumulatedTime()` throws `InternalErrorException` with the message *"Can't get the accumulated time while the timer is still running"* during `Scheduler.WriteDetailedSummary()`. This causes the build to **fail with an internal error** when it should have succeeded. The build result is lost and replaced with the `InternalErrorException`. In VS, this can manifest as a build that appears to fail or hang depending on how the VS solution build manager handles the unexpected exception from `EndBuild`. ### Stack Trace ``` at ErrorUtilities.ThrowInternalError(String message, Object[] args) at ScheduleTimeRecord.get_AccumulatedTime() at Scheduler.WriteRecursiveSummary(...) at Scheduler.WriteDetailedSummary(Int32 submissionId) at BuildManager.PerformSchedulingActions(IEnumerable responses) at BuildManager.HandleResult(Int32 node, BuildResult result) at BuildManager.ProcessPacket(Int32 node, INodePacket packet) at BuildManager.ProcessWorkQueue(Action action) ``` ## Fix Changed `ScheduleTimeRecord.AccumulatedTime` to return the best-effort elapsed time when the timer is still running (accumulated time + current elapsed since timer started), instead of throwing. This is diagnostic summary data used only for logging -- throwing serves no correctness purpose but causes builds to fail with an unrelated internal error. --------- Co-authored-by: Rainer Sigwald <raines@microsoft.com>
Member
|
/backport to vs18.5 |
Contributor
|
Started backporting to |
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.
Bug
ScheduleTimeRecord.get_AccumulatedTime()throwsInternalErrorExceptionwith the message "Can't get the accumulated time while the timer is still running" duringScheduler.WriteDetailedSummary().This causes the build to fail with an internal error when it should have succeeded. The build result is lost and replaced with the
InternalErrorException. In VS, this can manifest as a build that appears to fail or hang since the unexpected exception in MSBuild isn't propagated to VS.Stack Trace
Fix
Changed
ScheduleTimeRecord.AccumulatedTimeto return the best-effort elapsed time when the timer is still running (accumulated time + current elapsed since timer started), instead of throwing. This is diagnostic summary data used only for logging -- throwing serves no correctness purpose but causes builds to fail with an unrelated internal error.ADO bug:
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2901459