dotnet-api-docs icon indicating copy to clipboard operation
dotnet-api-docs copied to clipboard

Documentation for TaskScheduler.ThrowUnobservedTaskExceptions is messed up.

Open jhudsoncedaron opened this issue 3 months ago • 1 comments

Type of issue

Other (describe below)

Description

We were having a debate about relying on the behavior of throwing a task from an deliberately abandoned async task call. That is:

async Task Method();

Method(); // Don't wait for it to finish

This appears to be the primary documentation for what should happen, and it's talking out both sides of its mouth

"Occurs when a faulted task's unobserved exception is about to trigger exception escalation policy, which, by default, would terminate the process."

but

"To make it easier for developers to write asynchronous code based on tasks, unobserved exceptions raise the UnobservedTaskException exception, but the process does not terminate by default."

In addition, the XML fragment is not applicable to .NET Runtime but only .NET Framework.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskscheduler.unobservedtaskexception?view=net-9.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Threading.Tasks/TaskScheduler.xml

Document Version Independent Id

90bccf92-03c1-3825-ef4d-8cb8de33a9d7

Platform Id

a8b0bf93-f99f-7e0a-4aed-18fa354aa7b8

Article author

@dotnet-bot

jhudsoncedaron avatar Sep 19 '25 18:09 jhudsoncedaron