Skip to content

Documentation for TaskScheduler.ThrowUnobservedTaskExceptions is messed up.Β #11828

@jhudsoncedaron

Description

@jhudsoncedaron

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions