Skip to content

// Await the completed task. #12071

Closed

Description

@foofoodog

Why do the "int length = await firstFinishedTask; " instead of just using "int length = firstFinishedTask.Result;"?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. added
    help wanted
    and removed
    ⌚ Not Triaged
    on Apr 29, 2019
  2. added this to the Backlog milestone on Apr 29, 2019
  3. BillWagner commented on Apr 29, 2019

    @BillWagner
    Member

    Thanks for raising this question @foofoodog

    In most cases, both work. The difference is when the task is faulted. await will throw the first child exception stored in the AggregateException. The Result property will throw the AggregateException.

    I've added this to our backlog, and added the "up for grabs" label if you want to submit a PR that adds the answer I wrote above. Otherwise, we'll update it when we next update this article.

  4. added a commit that references this issue on Oct 1, 2019
    c898c6e
  5. added a commit that references this issue on Oct 1, 2019
    fd3a377
  6. removed this from the Backlog milestone on Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⌚ Not Triageddotnet-csharp/svchelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions