Treat an out-of-range navigation timeout as no timeout instead of throwing after undo/redo [patch] - #107
Merged
Conversation
…owing after undo/redo [patch] NavigateSafelyAsync called CancelAfter outside its try, so TimeSpan.MaxValue or a negative timeout threw ArgumentOutOfRangeException after the undo or redo had already been applied. The token source setup now sits inside the try, and timeouts that are not positive or exceed what CancelAfter accepts on every target run navigation without a timeout. Fixes #104 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xQ2dceFuWS8VLEn2xLuZE
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xQ2dceFuWS8VLEn2xLuZE
|
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 #104
What changed
NavigateSafelyAsyncis meant never to throw, but it calledCancellationTokenSource.CancelAfteroutside itstry.CancelAfterrejects negative delays other than −1 ms, and delays above its limit. SoTimeSpan.MaxValue, which is a natural way to say "no timeout", madeUndoAsync/RedoAsync/UndoToSaveBoundaryAsyncthrowArgumentOutOfRangeExceptionafter the change had already been applied.try, so nothing in navigation can escape.int.MaxValuems, now means navigation runs with no timeout.int.MaxValuems (about 24.8 days) is the limitCancelAfteraccepts on the older targets this library builds for, such as netstandard2.0. The default 5 s timeout is unchanged.Test
Added
UndoRedoAsync_NavigationTimeoutOutsideCancelAfterRange_AppliesAndNavigatesWithoutThrowing, a data-driven test overTimeSpan.MaxValue, 60 days, −5 s andTimeSpan.MinValue. For each value it checks that undo and redo returntrue, that the value changes, and that navigation still runs.ArgumentOutOfRangeException (Parameter 'delay').🤖 Generated with Claude Code
https://claude.ai/code/session_013xQ2dceFuWS8VLEn2xLuZE
Generated by Claude Code