Skip to content

Commit bfb3386

Browse files
committed
Add comment
1 parent f19a744 commit bfb3386

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Components/Components/src/ComponentBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ private async Task RunInitAndSetParametersAsync()
210210
catch when (task.IsCanceled)
211211
{
212212
// Ignore exceptions from task cancelletions.
213+
// Awaiting a canceled task may produce either an OperationCanceledException (if produced as a consequence of
214+
// CancellationToken.ThrowIfCancellationRequested()) or a TaskCanceledException (produced as a consequence of awaiting Task.FromCanceled).
215+
// It's much easier to check the state of the Task (i.e. Task.IsCanceled) rather than catch two distinct exceptions.
213216
}
214217

215218
// Don't call StateHasChanged here. CallOnParametersSetAsync should handle that for us.

0 commit comments

Comments
 (0)