FolderBrowserDialog often crashes on Windows 2000

H

hhh12347

FolderBrowserDialog often crashes on my Windows 2000 computer.

Here is C# source code for a test case:

using System;
using System.Windows.Forms;

public class InstanceForm : Form {
private FolderBrowserDialog folderBrowserDialog;
private String folderName;

private MainMenu mainMenu;
private MenuItem menuItem_Brow;
private MenuItem menuItem_File;

public InstanceForm () {
mainMenu = new MainMenu();

menuItem_File = new MenuItem();
menuItem_File.Text = "&File";

menuItem_Brow = new MenuItem();
menuItem_Brow.Text = "&Select Directory...";
menuItem_Brow.Shortcut = Shortcut.CtrlS;
menuItem_Brow.Click += new EventHandler (MenuItem_OnClick);

mainMenu.MenuItems.Add (menuItem_File);
menuItem_File.MenuItems.Add (menuItem_Brow);

folderBrowserDialog = new FolderBrowserDialog();
folderBrowserDialog.Description = "Select directory:";

Menu = mainMenu;
Text = "Instance Folder Browser Dialog";
}

private void MenuItem_OnClick (object sender, EventArgs e)
{
DialogResult result;

Console.WriteLine ("Entered Event Handler");
try {
result = folderBrowserDialog.ShowDialog ();
if (result == DialogResult.OK) {
folderName = folderBrowserDialog.SelectedPath;
}
}
catch (Exception ex) {
Console.WriteLine (ex);
}
}

[STAThread]
static void Main() {
Application.Run (new InstanceForm ());
}
}

When the test program crashes, it crashes immediately
after it displays the FolderBrowserDialog.
The FolderBrowserDialog appears normal.

An error message window appears. It says two sentences -
The instruction at "someAddress" referenced memory at
"sameAddress". The memory could not be "read". The two
addresses are always the same.

After closing error message window, a second error message
window appears. It says - programName has generated errors
and will be closed by Windows. You will need to restart
the program. An error log is being created.

The log file is a huge binary file. No exception gets
written to the console. No difference if try/catch
included or not.

When I ran the test program under Windows 2000, it crashed
on the first time I tried to display the FolderBrowserDialog
(Ctl-S) 4 times out of 10 times. The times it did not crash,
if I kept bringing up the FolderBrowserDialog, it always eventually
crashed.

I ran the tests immediately after rebooting the computer.
No other problems with the computer, and I have executed
lots of other .net stuff without any such crashes.

The test program has not crashed on my Windows XP computer.

The Windows 2000 computer says Version 5.00.2195
The Windows XP computer says Version 5.1.2600

*** Has this problem been reported before?
*** Anyone know the cause?
*** Anything wrong in source code that might cause crash?
*** Any suggestions how to track down what is happening?

*** Does this program crash on other people's Windows
2000 computer? Since I have not found any other reports
of this problem, maybe there is something different about
my computer, but as far as I know it is plain vanilla.
Can readers test on their Windows 2000 PC?

*** Is there a way to make the FolderBrowserDialog work
on Windows 2000? If not, is there an alternative suggested
way for selecting a directory?

If this is a known problem with .NET on Windows 2000, please
do not suggest users upgrade to XP. As far as I can tell,
FolderBrowserDialog is advertised to work. And I think it
is the responsibility of Microsoft to write software that
does not crash, not customer's responsibility to buy something
new in the hopes they will get it right this time. If there
is a official statement somewhere from Microsoft that
FolderBrowserDialog does not work on Windows 2000, I'd be
interested to know.

Thanks,
Daniel Goldman
 
G

Guest

I too am getting this error. However, only when I drill down to certain
directories
and only on a customer's machine. I can even duplicate the customer's
directory
structure on my machine and it works fine. Both machines are running Win 2000.

I've seen that other people have had this issue but no real resolutions.
Some suggest not setting the EnableVisualStyles but I don't even do that
anyway.

So i'm non the wiser...


FolderBrowserDialog often crashes on my Windows 2000 computer.

Here is C# source code for a test case:

using System;
using System.Windows.Forms;

public class InstanceForm : Form {
private FolderBrowserDialog folderBrowserDialog;
private String folderName;

private MainMenu mainMenu;
private MenuItem menuItem_Brow;
private MenuItem menuItem_File;

public InstanceForm () {
mainMenu = new MainMenu();

menuItem_File = new MenuItem();
menuItem_File.Text = "&File";

menuItem_Brow = new MenuItem();
menuItem_Brow.Text = "&Select Directory...";
menuItem_Brow.Shortcut = Shortcut.CtrlS;
menuItem_Brow.Click += new EventHandler (MenuItem_OnClick);

mainMenu.MenuItems.Add (menuItem_File);
menuItem_File.MenuItems.Add (menuItem_Brow);

folderBrowserDialog = new FolderBrowserDialog();
folderBrowserDialog.Description = "Select directory:";

Menu = mainMenu;
Text = "Instance Folder Browser Dialog";
}

private void MenuItem_OnClick (object sender, EventArgs e)
{
DialogResult result;

Console.WriteLine ("Entered Event Handler");
try {
result = folderBrowserDialog.ShowDialog ();
if (result == DialogResult.OK) {
folderName = folderBrowserDialog.SelectedPath;
}
}
catch (Exception ex) {
Console.WriteLine (ex);
}
}

[STAThread]
static void Main() {
Application.Run (new InstanceForm ());
}
}

When the test program crashes, it crashes immediately
after it displays the FolderBrowserDialog.
The FolderBrowserDialog appears normal.

An error message window appears. It says two sentences -
The instruction at "someAddress" referenced memory at
"sameAddress". The memory could not be "read". The two
addresses are always the same.

After closing error message window, a second error message
window appears. It says - programName has generated errors
and will be closed by Windows. You will need to restart
the program. An error log is being created.

The log file is a huge binary file. No exception gets
written to the console. No difference if try/catch
included or not.

When I ran the test program under Windows 2000, it crashed
on the first time I tried to display the FolderBrowserDialog
(Ctl-S) 4 times out of 10 times. The times it did not crash,
if I kept bringing up the FolderBrowserDialog, it always eventually
crashed.

I ran the tests immediately after rebooting the computer.
No other problems with the computer, and I have executed
lots of other .net stuff without any such crashes.

The test program has not crashed on my Windows XP computer.

The Windows 2000 computer says Version 5.00.2195
The Windows XP computer says Version 5.1.2600

*** Has this problem been reported before?
*** Anyone know the cause?
*** Anything wrong in source code that might cause crash?
*** Any suggestions how to track down what is happening?

*** Does this program crash on other people's Windows
2000 computer? Since I have not found any other reports
of this problem, maybe there is something different about
my computer, but as far as I know it is plain vanilla.
Can readers test on their Windows 2000 PC?

*** Is there a way to make the FolderBrowserDialog work
on Windows 2000? If not, is there an alternative suggested
way for selecting a directory?

If this is a known problem with .NET on Windows 2000, please
do not suggest users upgrade to XP. As far as I can tell,
FolderBrowserDialog is advertised to work. And I think it
is the responsibility of Microsoft to write software that
does not crash, not customer's responsibility to buy something
new in the hopes they will get it right this time. If there
is a official statement somewhere from Microsoft that
FolderBrowserDialog does not work on Windows 2000, I'd be
interested to know.

Thanks,
Daniel Goldman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top