Wednesday, April 10, 2013

.NET, C#, BackgroundWorker Not Responding in Windows 7

After my computer upgraded from Windows XP to Windows 7 (rather late upgrade), I noticed one of my Windows Forms application which using BackgroundWorker would freeze and appear Not Responding after a while. It didn't happen in Windows XP.

I couldn't figure out what caused this, and I have tried the following things in order. It's working but without UI update in ProgressChange. What's the point using BackgroundWorder?

1. add Threading.Sleep(500) after ReportProgress
2. The app used to read from a TreeView in DoWork. I converted it to a List and pass as argument.
3. Completely remove any UI related work in ProgressChange.


No comments: