views:

30

answers:

1

I have a really weird problem with background worker. Code is too complicated so will try and explain the problem just want to know if anyone has seen something similar. We have the UI thread spinning off a background thread The background thread does some printing to a pdf printer in the background When finished it just dies as in the thread function exits and so I expect the runworkercompleted event to be raised

this is win forms .NET 2.0

So every time we do a fresh install of the product and fire up our app the runworkercompleted even is not getting fired if we kill our app from task manager and start over it works like a charm ( naturaly we are a little concerned that the first thing a user sees with our product is a hang :-) )

Logging has confirmed that in every case i) The background worker thread function does exit cleanly ii) No exceptions are raised in said thread func

This is 100% reproable on two machine one a win7 and one Vista Sp1. its really, I cannot understand what the first time run has to do with it

Any suggestions welcome

+1  A: 

Is the RunWorkerCompleted event actually registered to the BackgroundWorkers event handler?

It may seem almost a sanity check, but that could explain why teh BackgroundWorker exits cleanly, and the RunWorkerCompleted is not fired.

Shadow
yeah it is, keep in mind it starts working from the second time around
Rahul
Sorry, I missed that in your description; can you post a code sample of your BackgroundWorker skeleton? Also is the breakpoint directly at the start of the RunWorkerCompleted sub?
Shadow