I have very strange behavior when using FolderBrowserDialog in a C # application. After the FolderBrowserDialog is displayed, some events will not be fired in the application, for example, the DoWork event for BackgroundWorker or the renamed FileSystemWatcher event.
Please note that this problem only occurs on certain machines. The problem does not occur on my development machine, nor on many other production machines with the same equipment (Xeon W3550 processor) as the machines where the problem occurs. All machines running the application are under Windows XP SP3.
I managed to isolate the problem in a very simple application. The code is shown below:
public partial class Form1 : Form { BackgroundWorker backgroundWorker; public Form1() { InitializeComponent(); listBox1.Items.Add("Initialization"); backgroundWorker = new BackgroundWorker(); backgroundWorker.WorkerReportsProgress = true; backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); } private void Form1_Load(object sender, EventArgs e) { listBox1.Items.Add("Running worker"); FolderBrowserDialog folderbrowserDialog = new FolderBrowserDialog(); folderbrowserDialog.ShowDialog();
I run the application and I get 2 snapshots below after displaying the FolderBrowserDialog and I click OK or Cancel in the form of the FolderBrowserDialog.
On my dev PC, I get the following:

On the machine where the problem occurs, BackgroundWorker does not fire because the DoWork event never fires:

If the following line is deleted in the code, the worker works as expected on all machines.
folderbrowserDialog.ShowDialog();
Additional Information
- If I replaced FolderbrowserDialog with OpenFileDialog, the worker will work as expected. So it really looks like a FolderbrowserDialog component ...
- A few weeks ago, I tried installing Visual Studio on a machine where I was having a problem. The application works as expected only when launched from the debugger. The problem occurred when starting without debugging.
- Switching to .NET FW 3.0 and 4.0 did not solve the problem.
- A user logged on to Windows has administrator privileges.
- Replacing the PC did not solve the problem.
Do you have ideas to explain how this might cause FolderbrowserDialog?
source share