Greetings,
I was much encouraged to see the new BackgroundWorker class in .NET v2. On
the face of it, much easier to use than the various delegates and events of
yore, though I imagine the same base classes are being invoked.
Anyway, I have given it a try with a VB.NET application that generates
charts. Since there are some 3,000 charts to do, I wanted to put the chart
generation on a separate thread. Works fine inasmuch as the charts are made.
The problem is that the form UI is frozen after the job completes.
Actually, I think it freezes at some point during the background job running
but I haven't been able to determine if it is always after a fixed amount of
time.
For the first few minutes of background thread operation, I can move the
form around, minimize it etc. I repeat this exercise from time to time; most
often, the form is still responsive while othertimes it freezes. I am
testing this on a dual CPU HP DC7100, XP Pro, SP2.
I have treble-checked that nothing in the background thread touches the
form. I use a separate SQL connection from that used for populating UI
controls; I have taken the BackgroundWorker1 object off the form design
surface and declared it manually (WithEvents); I have commented out all
ReportProgress calls (saw something on these perhaps being too frequent).
At the end of the job, I pop up a message box to say all done. This is
within the RunWorkerCompleted event. My understanding is that once this
event fires, then the background thread is finished and control is
automatically handed back to the UI thread. Is this correct?
Any ideas as to why the form freezes gratefully received. Are there any
tricks I can employ to determine at which point things are going wrong?
Thanks and regards
Sebastian Crewe