Skip to content

Erroneous text about discards suppressing task exceptions #48632

@Trisibo

Description

@Trisibo

Type of issue

Other (describe below)

Description

In the A standalone discard section, the example about assigning a Task.Run result to a discard says that "Assigning the task has the effect of suppressing the exception that the operation throws as it is about to complete", but this is not true, as the next note suggests ("Without a debugger attached, the exception is silently ignored in both cases"), the only thing the discard suppresses is the compiler warning.

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/discards

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/fundamentals/functional/discards.md

Document Version Independent Id

6edd2f85-a04b-e9ad-2fc9-fc23dbfc5bba

Platform Id

40b6390c-6a9c-ee3f-7649-f06600b45577

Article author

@BillWagner

Metadata

  • ID: 7ace3d2c-a7f7-c667-5f50-b8d8f1dfc87a
  • PlatformId: 40b6390c-6a9c-ee3f-7649-f06600b45577
  • Service: dotnet-csharp
  • Sub-service: fundamentals

Related Issues

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