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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:23:34+00:00 2026-05-24T19:23:34+00:00

I can not find any documentation that specifies on which thread WebClient raises its

  • 0

I can not find any documentation that specifies on which thread WebClient raises its events. I ran some tests and determined the following:

  • If called from a UI thread (say from an event handler) the event handler will be executed on that thread. As a test, I added an infinite loop after the call to OpenReadAsync. The event handler was never called.

  • If there is no UI thread, like in a console application, the event handler will be executed on a thread pool thread. In this case, if I wanted to provide some results the rest of the application, I would have to be aware of threading issues.

Is this behaviour documented anywhere? I found nothing.

I have the basically the same question concerning the new async features of C# – eventually, the asynchronous code will have to be executed. Will that also spawn a thread pool thread when there is no UI thread? Will that, in turn, require thread safe code?

I feel that I am missing something here – I can only find very little information about this, but this seems important to me.

  • 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-24T19:23:34+00:00Added an answer on May 24, 2026 at 7:23 pm

    For WebClient, I haven’t found it documented either, but have seen the same behaviour as you. Essentially this can be described as “if there’s an active synchronization context when the call is started, it’s used – otherwise the thread pool is used.”

    For the async behaviour in C# 5, it depends on the implementation of whatever you’re awaiting… but I believe the awaiter for Task<T> will use TaskScheduler.Current to schedule a continuation – which means you’ll see the same sort of behaviour. (It’s not necessarily just a UI thread which sets a task scheduler, but that’s the most obvious example.)

    When thread pool threads are used, it should still be thread-safe – the method is only executing in a single thread at a time, and I believe the Task Parallel Library performs all the required memory barriers.

    If you’re interested in how async hangs together behind the scenes, you might want to read my Eduasync blog series.

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

Sidebar

Related Questions

This is a recent error that I can't find any documentation for. It might
HEllo , i can not find any way to get horizontal or/and vertical resolution
I have not been able to find any definitive answers to this question: Can
I've searched around but I can't find any information about this; maybe I'm not
all. Maybe i've not googled enough, but i can't find any example on this
I cannot seem to find any documentation of what events fire and when in
I can't find any good documentation on the linkable behaviour for cakephp. I'm trying
I cant find any documentation on this, I dont even know if its possible.
I can not find how to implement a design in C++. In the language
I have looked all over the web and I can not find the information

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.