FolderBrowserDialog crashes on Windows 2000

H

hhh12347

FolderBrowserDialog crashes on my Windows 2000 computer.

Here is a C# test program:

using System;
using System.Windows.Forms;

public class TestForm : Form {
FolderBrowserDialog folderBrowserDlg;
OpenFileDialog openFileDlg;
String folderName;
String fileName;

MainMenu mainMenu;
MenuItem mi_Browse;
MenuItem mi_Open;
MenuItem mi_FileMenu;
MenuItem mi_Exit;

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

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

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

mi_Open = new MenuItem();
mi_Open.Text = "&Open File...";
mi_Open.Shortcut = Shortcut.CtrlO;
mi_Open.Click += new EventHandler (MI_Open_OnClick);

mi_Exit = new MenuItem();
mi_Exit.Text = "E&xit Test...";
mi_Exit.Shortcut = Shortcut.CtrlX;
mi_Exit.Click += new EventHandler (MI_Exit_OnClick);

mainMenu.MenuItems.Add (mi_FileMenu);
mi_FileMenu.MenuItems.Add (mi_Browse);
mi_FileMenu.MenuItems.Add (mi_Open);
mi_FileMenu.MenuItems.Add (mi_Exit);

folderBrowserDlg = new FolderBrowserDialog ();
openFileDlg = new OpenFileDialog ();

Menu = mainMenu;
Text = "Dialog Test Form";
}

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

result = folderBrowserDlg.ShowDialog ();
if (result == DialogResult.OK) {
folderName = folderBrowserDlg.SelectedPath;
}
}

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

result = openFileDlg.ShowDialog ();
if (result == DialogResult.OK) {
fileName = openFileDlg.FileName;
}
}

void MI_Exit_OnClick (object sender, EventArgs e)
{
Close ();
}

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

Under Windows 2000, 4 of 10 times, it crashed first time I
tried to display the FolderBrowserDialog. I ran the tests
right after rebooting. To run the test, start the program,
and press Ctrl-S. The times it did not immediately crash,
if I kept bringing up the FolderBrowserDialog, it crashed
pretty soon. OpenFileDialog (included in test program)
does not crash on Windows 2000. FolderBrowserDialog
has not crashed on Windows XP computer.

When FolderBrowserDialog crashes, it's immediately after it
displays the dialog. The dialog appears normal.

An error message window appears - 'The instruction at
"address" referenced memory at "address". The memory
could not be "read". The two addresses are always the same.
After closing error message window, a second error message
window appears - 'program 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.

It would surprise me if FolderBrowserDialog crashed Windows
2000, and nobody reported it before. However, I have no way
of knowing at this point. The Windows 2000 computer I tested
on is pretty stable. Sometimes, Windows Explorer does crash
on the computer, but it's been more than a month.

To help figure this out:

* Has FolderBrowserDialog crashing been reported before,
either on Microsoft site or elsewhere? I could not find.

* Can someone run same test on their Windows 2000 multiple
times, and post whether it crashes or not?

* Has anyone used FolderBrowserDialog in a desktop .NET
application, and tested it to be stable with Windows 2000?

Many thanks,
Daniel Goldman
 
P

Publicjoe

Hi Daniel,

I have compiled your code on Windows 2000, run it several times, and it does
exactly what it should. No crahses after about 20 times of using it.

Hope this helps

Publicjoe

C# Tutorial at http://www.publicjoe.f9.co.uk/csharp/tut.html
C# Ebook at http://www.publicjoe.f9.co.uk/csharp/samples/ebook.html - 71
Chapters
VB Ebook at http://www.publicjoe.f9.co.uk/vbnet/samples/ebook.html - 28
Chapters
C++ Ebook at http://www.publicjoe.f9.co.uk/cppt/samples/ebook.html - 8
Chapters
Java Ebook at http://www.publicjoe.f9.co.uk/java/samples/ebook.html - 2
Chapters


FolderBrowserDialog crashes on my Windows 2000 computer.

Here is a C# test program:

using System;
using System.Windows.Forms;

public class TestForm : Form {
FolderBrowserDialog folderBrowserDlg;
OpenFileDialog openFileDlg;
String folderName;
String fileName;

MainMenu mainMenu;
MenuItem mi_Browse;
MenuItem mi_Open;
MenuItem mi_FileMenu;
MenuItem mi_Exit;

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

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

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

mi_Open = new MenuItem();
mi_Open.Text = "&Open File...";
mi_Open.Shortcut = Shortcut.CtrlO;
mi_Open.Click += new EventHandler (MI_Open_OnClick);

mi_Exit = new MenuItem();
mi_Exit.Text = "E&xit Test...";
mi_Exit.Shortcut = Shortcut.CtrlX;
mi_Exit.Click += new EventHandler (MI_Exit_OnClick);

mainMenu.MenuItems.Add (mi_FileMenu);
mi_FileMenu.MenuItems.Add (mi_Browse);
mi_FileMenu.MenuItems.Add (mi_Open);
mi_FileMenu.MenuItems.Add (mi_Exit);

folderBrowserDlg = new FolderBrowserDialog ();
openFileDlg = new OpenFileDialog ();

Menu = mainMenu;
Text = "Dialog Test Form";
}

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

result = folderBrowserDlg.ShowDialog ();
if (result == DialogResult.OK) {
folderName = folderBrowserDlg.SelectedPath;
}
}

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

result = openFileDlg.ShowDialog ();
if (result == DialogResult.OK) {
fileName = openFileDlg.FileName;
}
}

void MI_Exit_OnClick (object sender, EventArgs e)
{
Close ();
}

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

Under Windows 2000, 4 of 10 times, it crashed first time I
tried to display the FolderBrowserDialog. I ran the tests
right after rebooting. To run the test, start the program,
and press Ctrl-S. The times it did not immediately crash,
if I kept bringing up the FolderBrowserDialog, it crashed
pretty soon. OpenFileDialog (included in test program)
does not crash on Windows 2000. FolderBrowserDialog
has not crashed on Windows XP computer.

When FolderBrowserDialog crashes, it's immediately after it
displays the dialog. The dialog appears normal.

An error message window appears - 'The instruction at
"address" referenced memory at "address". The memory
could not be "read". The two addresses are always the same.
After closing error message window, a second error message
window appears - 'program 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.

It would surprise me if FolderBrowserDialog crashed Windows
2000, and nobody reported it before. However, I have no way
of knowing at this point. The Windows 2000 computer I tested
on is pretty stable. Sometimes, Windows Explorer does crash
on the computer, but it's been more than a month.

To help figure this out:

* Has FolderBrowserDialog crashing been reported before,
either on Microsoft site or elsewhere? I could not find.

* Can someone run same test on their Windows 2000 multiple
times, and post whether it crashes or not?

* Has anyone used FolderBrowserDialog in a desktop .NET
application, and tested it to be stable with Windows 2000?

Many thanks,
Daniel Goldman
 
G

Guest

I too just tried your code on a 2K SP4 machine with no ill results. Have you
been able to try it on any other 2K machines?

Brendan

FolderBrowserDialog crashes on my Windows 2000 computer.

Here is a C# test program:

using System;
using System.Windows.Forms;

public class TestForm : Form {
FolderBrowserDialog folderBrowserDlg;
OpenFileDialog openFileDlg;
String folderName;
String fileName;

MainMenu mainMenu;
MenuItem mi_Browse;
MenuItem mi_Open;
MenuItem mi_FileMenu;
MenuItem mi_Exit;

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

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

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

mi_Open = new MenuItem();
mi_Open.Text = "&Open File...";
mi_Open.Shortcut = Shortcut.CtrlO;
mi_Open.Click += new EventHandler (MI_Open_OnClick);

mi_Exit = new MenuItem();
mi_Exit.Text = "E&xit Test...";
mi_Exit.Shortcut = Shortcut.CtrlX;
mi_Exit.Click += new EventHandler (MI_Exit_OnClick);

mainMenu.MenuItems.Add (mi_FileMenu);
mi_FileMenu.MenuItems.Add (mi_Browse);
mi_FileMenu.MenuItems.Add (mi_Open);
mi_FileMenu.MenuItems.Add (mi_Exit);

folderBrowserDlg = new FolderBrowserDialog ();
openFileDlg = new OpenFileDialog ();

Menu = mainMenu;
Text = "Dialog Test Form";
}

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

result = folderBrowserDlg.ShowDialog ();
if (result == DialogResult.OK) {
folderName = folderBrowserDlg.SelectedPath;
}
}

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

result = openFileDlg.ShowDialog ();
if (result == DialogResult.OK) {
fileName = openFileDlg.FileName;
}
}

void MI_Exit_OnClick (object sender, EventArgs e)
{
Close ();
}

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

Under Windows 2000, 4 of 10 times, it crashed first time I
tried to display the FolderBrowserDialog. I ran the tests
right after rebooting. To run the test, start the program,
and press Ctrl-S. The times it did not immediately crash,
if I kept bringing up the FolderBrowserDialog, it crashed
pretty soon. OpenFileDialog (included in test program)
does not crash on Windows 2000. FolderBrowserDialog
has not crashed on Windows XP computer.

When FolderBrowserDialog crashes, it's immediately after it
displays the dialog. The dialog appears normal.

An error message window appears - 'The instruction at
"address" referenced memory at "address". The memory
could not be "read". The two addresses are always the same.
After closing error message window, a second error message
window appears - 'program 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.

It would surprise me if FolderBrowserDialog crashed Windows
2000, and nobody reported it before. However, I have no way
of knowing at this point. The Windows 2000 computer I tested
on is pretty stable. Sometimes, Windows Explorer does crash
on the computer, but it's been more than a month.

To help figure this out:

* Has FolderBrowserDialog crashing been reported before,
either on Microsoft site or elsewhere? I could not find.

* Can someone run same test on their Windows 2000 multiple
times, and post whether it crashes or not?

* Has anyone used FolderBrowserDialog in a desktop .NET
application, and tested it to be stable with Windows 2000?

Many thanks,
Daniel Goldman
 
H

hhh12347

Thanks for testing. No, I have not been able to try on any other
WIndows 2000 computers. Could anyone else please run the test
program for FolderBrowserDialog multiple times?

Daniel Goldman
 
K

Kostya Ergin

How to show this dialogue from any folder?

like this:

folderBrowserDlg.RootFolder = @"C:\";



FolderBrowserDialog crashes on my Windows 2000 computer.

Here is a C# test program:

using System;
using System.Windows.Forms;

public class TestForm : Form {
FolderBrowserDialog folderBrowserDlg;
OpenFileDialog openFileDlg;
String folderName;
String fileName;

MainMenu mainMenu;
MenuItem mi_Browse;
MenuItem mi_Open;
MenuItem mi_FileMenu;
MenuItem mi_Exit;

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

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

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

mi_Open = new MenuItem();
mi_Open.Text = "&Open File...";
mi_Open.Shortcut = Shortcut.CtrlO;
mi_Open.Click += new EventHandler (MI_Open_OnClick);

mi_Exit = new MenuItem();
mi_Exit.Text = "E&xit Test...";
mi_Exit.Shortcut = Shortcut.CtrlX;
mi_Exit.Click += new EventHandler (MI_Exit_OnClick);

mainMenu.MenuItems.Add (mi_FileMenu);
mi_FileMenu.MenuItems.Add (mi_Browse);
mi_FileMenu.MenuItems.Add (mi_Open);
mi_FileMenu.MenuItems.Add (mi_Exit);

folderBrowserDlg = new FolderBrowserDialog ();
openFileDlg = new OpenFileDialog ();

Menu = mainMenu;
Text = "Dialog Test Form";
}

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

result = folderBrowserDlg.ShowDialog ();
if (result == DialogResult.OK) {
folderName = folderBrowserDlg.SelectedPath;
}
}

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

result = openFileDlg.ShowDialog ();
if (result == DialogResult.OK) {
fileName = openFileDlg.FileName;
}
}

void MI_Exit_OnClick (object sender, EventArgs e)
{
Close ();
}

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

Under Windows 2000, 4 of 10 times, it crashed first time I
tried to display the FolderBrowserDialog. I ran the tests
right after rebooting. To run the test, start the program,
and press Ctrl-S. The times it did not immediately crash,
if I kept bringing up the FolderBrowserDialog, it crashed
pretty soon. OpenFileDialog (included in test program)
does not crash on Windows 2000. FolderBrowserDialog
has not crashed on Windows XP computer.

When FolderBrowserDialog crashes, it's immediately after it
displays the dialog. The dialog appears normal.

An error message window appears - 'The instruction at
"address" referenced memory at "address". The memory
could not be "read". The two addresses are always the same.
After closing error message window, a second error message
window appears - 'program 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.

It would surprise me if FolderBrowserDialog crashed Windows
2000, and nobody reported it before. However, I have no way
of knowing at this point. The Windows 2000 computer I tested
on is pretty stable. Sometimes, Windows Explorer does crash
on the computer, but it's been more than a month.

To help figure this out:

* Has FolderBrowserDialog crashing been reported before,
either on Microsoft site or elsewhere? I could not find.

* Can someone run same test on their Windows 2000 multiple
times, and post whether it crashes or not?

* Has anyone used FolderBrowserDialog in a desktop .NET
application, and tested it to be stable with Windows 2000?

Many thanks,
Daniel Goldman
 
H

hhh12347

You use a Environment.SpecialFolder constant to set the
root directory. I am pretty sure it does not allow you to set
the root from any folder, and not from "C:\" directory

folderBrowserDlg.RootFolder = Environment.SpecialFolder.Personal;

The closest you can get to what you want is use SelectedPath

*****

Did you try running the test program on Windows 2000?

In response to Brendan's previous question, I just installed
..NET to a Windows 98 computer. The FolderBrowserDialog
test program ran fine on the Windows 98 PC. No crashes.
That is reassuring, but I would still greatly appreciate it if
others could test on Windows 2000. Daniel Goldman
 
H

hhh12347

If yes means you repeatedly ran the test program,
did it crash? Thanks, Daniel Goldman
 
K

Kostya Ergin

I have started it on XP Pro and 2k (russian). It works completely well.

Earlier used their code:

====================================
// FolderBrowser.cs :
// Written by Pardesi Services, LLC
// Version 1.0.0
====================================

Here it is bad. :)
 
H

hhh12347

I am suspecting it is something with my Windows 2000. Yesterday, my
Netscape Mail client crashed with same error message. And, as I said
previously, Windows Explorer also occasionally crashes with same error.

I would still appreciate someone else running the test program on
Windows
2000. It would be reassuring to hear FolderBrowserDialog does not crash
on other's Windows 2000 computers.

Thanks,
Daniel Goldman

PS - I have applied all Windows 2000 updates.
 

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