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 8006695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:35:54+00:00 2026-06-04T17:35:54+00:00

I am testing out the httpClient sendAsync method. Synchrnous call it works fine. But,

  • 0

I am testing out the httpClient sendAsync method. Synchrnous call it works fine. But, when I try to do asynchronous http
requests, the task terminated before I process the message. Any body encountered with this issue?

This synchronous call works

HttpRequestMessage httprequest = new HttpRequestMessage(httpmethod, "http://www.google.ca");
var result =   _httpClient.SendAsync(httprequest, HttpCompletionOption.ResponseContentRead, cancellationToken);
HttpResponseMessage response = result.Result;

But the Asynchrnous call doesn’t work. The thread dies when I try to parse the response.

HttpRequestMessage httprequest = new HttpRequestMessage(httpmethod, "http://www.google.ca");
var result =   await _httpClient.SendAsync(httprequest, HttpCompletionOption.ResponseContentRead, cancellationToken);
HttpResponseMessage response = result;

any help is appreciated.

  • 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-06-04T17:35:56+00:00Added an answer on June 4, 2026 at 5:35 pm

    If you are using VS11 Beta, then make sure your unit test returns Task, not void.

    If you’re using VS2010 or VS11 Dev Preview, then you can use my Async Unit Tests project.

    Full details are on my blog, but it boils down to this:

    • async will return when it has to asynchronously wait.
    • In a unit test, it’s returning to the test runner, which sees the test complete.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am testing out the Facebook request dialog. The dialog launches fine, but when
I am testing out mod rewrite for my site. I thought i would try
I'm testing out an app (hopefully to run on heroku, but am having issues
I'm testing out my CSS at http://flexibletheme.tumblr.com/ and trying to make the website responsive
I'm testing out the billing sample application provided by google: http://developer.android.com/guide/market/billing/index.html Everything is going
I am testing out the idea of threads, but only in very key spots
I am testing out erode and dilate functions in openCV2.2 but compilation fails because
I'm currently testing out retrieving json from jquery. The service url is: http://imgsvc.heroku.com/images In
I am just testing out the onLocationChanged method in Android , I have implemented
I'm testing out WPF for the first time and I'm trying to call a

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.