Repository navigation
Fault the run when a render pass throws a foreign OperationCanceledException [patch] - #253
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
…nceledException Since #247 a render failure escapes the input loop, but nothing wrapped an OperationCanceledException that didn't come from cancelling the run. Leaving the async RunAsync, it made the task Canceled, so a Post action that hit an HttpClient timeout looked like a clean shutdown. The initial pass and both passes in the input loop now go through RenderDuringRun, which wraps it in InvalidOperationException as the input path does. Fixes #248 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4towbdqS7BHdCDNqm
|
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 #248
What changed
#216 made an
OperationCanceledExceptionthat doesn't come from cancelling the run faultRunAsync, but only on the input path. #247 let render failures escape the input loop, and that path had no wrap. So a foreign OCE thrown during a pass (from aPostaction, an element'sOnRender, or the initialRender()) passed throughRunAsync's generalcatch { throw; }. Leaving anasyncmethod, that made the task Canceled, and a host read it as a clean shutdown.UIApplicationnow has a privateRenderDuringRun(CancellationToken)helper, called from the initial render inRunAsyncand from both passes inProcessInputAsync. When a pass throws an OCE and the run's token is not cancelled, the helper wraps it inInvalidOperationException, keeping the original as the inner exception, the same way the input path does. An OCE that does come from cancelling the run passes through unchanged, so a shutdown during a pass still ends the run quietly.Render()called directly behaves as before.Tests
New tests in
UIApplicationRenderFailureTests:AForeignCancellationOnTheFirstPassFaultsTheRun: the initial renderAForeignCancellationFromAPostedActionFaultsTheRun: the issue'sPostreproAForeignCancellationOnThePassAfterAKeyFaultsTheRun: anOnRenderthat starts throwing after a keyCancellingTheRunDuringAPassStillEndsItQuietly: guards the run's own cancellationThe first three check for a Faulted run with an
InvalidOperationExceptionwhose inner exception is the originalTaskCanceledException. With theUIApplicationchange reverted, all three fail and the fourth still passes. With it in place, the full suite passes (331/331).Generated by Claude Code