Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6930579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:27:56+00:00 2026-05-27T11:27:56+00:00

I have a problem with async-await expression which returns wrong result. private Task<int> A

  • 0

I have a problem with async-await expression which returns wrong result.

private Task<int> A
{
    get
    {
        return TaskEx.RunEx<int>(async () =>
        {
            Thread.Sleep(10000);
            return 2;
        });
    }
}

private Task<int> B
{
    get
    {
        return TaskEx.RunEx<int>(async () =>
        {
            Thread.Sleep(4000);
            return 4;
        });
    }
}

private string SumAll(int a, int b)
{
    return (a + b).ToString();
}

Now, when I want to sum properties A and B by launching SumAll method I get the result 4 where I should get 6. Below you can find a code which does not work.

private async void Sum_Click(object sender, RoutedEventArgs e)
{
    this.Result.Text = this.SumAll(await A, await B);
}

When, I do the same example with the method below I got the right result.

private async void Sum_Click(object sender, RoutedEventArgs e)
{
    var a = await A;
    var b = await B;
    this.Result.Text = this.SumAll(a, b);
}

BTW. I know that the best way would be to use WhenAll method, but I am learing.
Thank you for your answers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:27:57+00:00Added an answer on May 27, 2026 at 11:27 am

    Yes, this is a known bug with the CTP (my blog; Lucian Wischik’s blog). It’ll be fixed in the full release.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with return statment >.< I want to store all magazine names
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
i have a problem whenever i Refresh the prograss bar i get the error
I have a problem where I can get tracking to work fine, however I
I have a problem using C++11 futures. When I call wait() or get() on
I have a multipart mail which is processed using async read on sockets. The
I have a TabActivity with 3 tabs. There is an async task that when
I have problem with evaluation XPath expression in Windows Script Host using JScript when
I'm using head.js (http://headjs.com) to do async loading of my javascripts. I have problem
i bascially have an activity that calls an async task to set up the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.