BackgroundWorker is not being called?

The BackgroundWorker class needs the message pump already running, and will not work if you call it too early in your application (before Application.Run()).

The BackgroundWorker class needs the message pump already running, and will not work if you call it too early in your application (before Application.Run()). If you are doing this from something like a splash screen that is run before the main application starts, unfortunately, you will need to do your own threading instead of using BackgroundWorker. Note: As Henk Holterman points out, if you don't have a message pump at all (because you have a console app instead of Winforms or WPF), than BackgroundWorker will not work at all in your app.

It doesn't work even when I use my own threading. – Or A Nov 2 '10 at 15:26 I am having trouble finding where I read that, but the BackgroundWorker is specifically designed to be used from the UI thread in i.e. A WinForms application.

I guess it uses the message loop to communicate its events to/from the UI thread. So before Application.Run(), it probably gets created, but never gets signaled to start. Using a System.Threading.

Thread instead of a BackgroundWorker is probably the way to go. – M-Peror Nov 2 '10 at 15:58.

We are looking at a edited version of your code. You removed the bits that cause the deadlock. Some notes: You mention a 'status progress bar' but your code shows no evidence for it.

Getting that bar updated provides ample ways for deadlock. The commented calls to PublishStatus are a red flag There is no evidence of a RunWorkerCompleted event handler even though you'd need one to get your splash screen closed. The BGW will deadlock when your main thread is blocking on the BGW and not pumping messages There's a corner case for circular dependencies between assemblies.

Your code will hang in an endless loop. Diagnose with Build + Clean, Build + Build. Remote, but several .

NET assemblies as well as C++/CLI assemblies have a module initializer. It may not necessarily act properly when the assembly is loaded on a non-STA worker thread. RunWorkerCompleted is my best guess until you show an unedited version of your code.

You cannot pre-load assemblies that easily. Take a look at my question.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions