From efa9a4e530b2e9ebafe672a78b5ecae2e346d19f Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 10 May 2019 18:12:32 +0100 Subject: [PATCH] In components event dispatch, use explicit fire-and-forget instead of async void (#10149) --- .../Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs b/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs index 71a3a14741..0e1e237b6b 100644 --- a/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs +++ b/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs @@ -152,13 +152,16 @@ namespace Microsoft.AspNetCore.Blazor.Rendering if (deferredIncomingEvents.Count > 0) { - ProcessNextDeferredEvent(); + // Fire-and-forget because the task we return from this method should only reflect the + // completion of its own event dispatch, not that of any others that happen to be queued. + // Also, ProcessNextDeferredEventAsync deals with its own async errors. + _ = ProcessNextDeferredEventAsync(); } } } } - private async void ProcessNextDeferredEvent() + private async Task ProcessNextDeferredEventAsync() { var info = deferredIncomingEvents.Dequeue(); var taskCompletionSource = info.TaskCompletionSource;