Skip to content

Commit 5415283

Browse files
committed
Fix DispatchEvent
1 parent 298c178 commit 5415283

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Components/Components/src/RenderTree/Renderer.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,16 +416,24 @@ public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo? fie
416416
// The event handler might request multiple renders in sequence. Capture them
417417
// all in a single batch.
418418
_isBatchInProgress = true;
419+
420+
task = callback.InvokeAsync(eventArgs);
419421
if (quiesce)
420422
{
423+
// If we are waiting for quiescence, the quiescence task will capture any async exception.
424+
// If the exception is thrown synchronously, we just want it to flow to the callers, and
425+
// not go through the ErrorBoundary.
421426
_pendingTasks ??= new();
427+
AddPendingTask(receiverComponentState, task);
422428
}
423-
424-
task = callback.InvokeAsync(eventArgs);
425-
AddToPendingTasksWithErrorHandling(task, receiverComponentState);
426429
}
427430
catch (Exception e)
428431
{
432+
if (quiesce)
433+
{
434+
// Exception filters are not AoT friendly.
435+
throw;
436+
}
429437
HandleExceptionViaErrorBoundary(e, receiverComponentState);
430438
return Task.CompletedTask;
431439
}

0 commit comments

Comments
 (0)