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

  • Home
  • SEARCH
  • 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 7731709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:33:00+00:00 2026-06-01T06:33:00+00:00

In my WPF application I am loading content using Dispatcher.BeginInvoke in the constructor. My

  • 0

In my WPF application I am loading content using Dispatcher.BeginInvoke in the constructor. My question is will it block the UI thread?

Or is it better to use Task.Factory.StartNew and then dispatching things back on UI so that application will load first irrespective of the loading content process time?

Which is better approach and why?

  • 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-01T06:33:01+00:00Added an answer on June 1, 2026 at 6:33 am

    They do two very different things:

    • Task.Factory.StartNew schedules a delegate for execution on a
      thread pool thread. The current thread continues to run without waiting for a result of this task (async). Typically you would spawn a longer running background task so that the UI is not blocked for too long (not “frozen”).

    • Dispatcher.BeginInvoke schedules a delegate for execution on the
      dispatcher (UI) thread. Typically this is done to update some UI
      controls with the results of some operation that was executed on a
      background thread. Essentially you are updating the UI here.

    To answer you questions directly:

    You should not schedule lengthy operations on the Dispatcher thread, typically you only want to update UI controls here. The code in the delegate will be executed on the UI thread, which is blocked for the time of the execution. Just put a Thread.Sleep(10000) in your current code (that you schedule from the constructor) and you will see the UI will freeze. Use a background task for this – either with a Task or a background worker (both will use a thread pool thread).

    Or is it better to use Task.Factory.StartNew and then dispatching
    things back on UI so that application will load first irrespective of
    the loading content process time.

    Yes!

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

Sidebar

Related Questions

I have this WPF application using NHibernate and lazy data loading. I also use
My WPF application is structured using the MVVM pattern. The ViewModels will communicate asynchronously
I'm designing a WPF program that will use a DLL-plugin architecture. The host application
I am using WPF Standalon application and at the login time we are loading
The Splashscreen/Loading-Window in my WPF application is set to Topmost=True . Now this windows
(using WPF application) I get an error when i want to save a bool
I am attempting to use the Browser control in a very simple WPF application,
Recently our WPF/Entity Framework 4.0 application has become unstable after we began using backgroundworkers
Background/context for this question: I have a WPF desktop application. It uses LINQ to
I have a WPF application with two background worker threads that operate while loading.

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.