ShowDialog shows modeless form(?)

H

Helge

I just figured out that the ShowDialog method does not display a form
modally if it is executed from a "busy" ('application not responding'-type )
form. Would be great if anybody confirmed this behaviour.

I put a short example here: Add a button to a form and a click event handler
with the following code:

private void button1_Click(object sender, System.EventArgs e) {
ModalFrm lFrm; // Just an empty form.

System.Threading.Thread.Sleep(10000); // Simulate heavy processing.
// Application.DoEvents();
lFrm = new ModalFrm();
lFrm.ShowDialog(this);
}

After starting the application and clicking on the button, the thread falls
to sleep. While the thread is sleeping keep clicking somewhere on the form,
so that it will display "(application not responding)" after a while. Stop
clicking. When the thread awakes again, it shows the other form. BUT: Notice
that the second form is not modal! The MainFrm is not blocked.

Afer experimenting a lot, I put an Application.DoEvents() after the
Thread.Sleep and suddenly the second form was modal again.

I am not sure if this is a wanted behaviour. This is all tested against .Net
Framework 1.1 and Windows Server 2003.

Helge
 
H

Helge

I rechecked against a
- Windows XP / .Net Framework 1.1 and a
- Windows 2000 Server / .Net Framework 1.1
system. On both systems ShowDialog() behaves like it is supposed to. Seems
to be specific to Windows 2003 Server.

Crazy...
Me be there is somebody who could confirm this "bug" (for Win2003Server).

Thanks,
Helge
 
E

Elp

Hi,

Helge said:
I rechecked against a
- Windows XP / .Net Framework 1.1 and a
- Windows 2000 Server / .Net Framework 1.1
system. On both systems ShowDialog() behaves like it is supposed to. Seems
to be specific to Windows 2003 Server.

Crazy...
Me be there is somebody who could confirm this "bug" (for Win2003Server).

Tried under Win2003 server (.NET 1.0): bug confirmed.

Tried under WinXP (.NET 1.0): behaves as documented (ie no bug).

Congratulation Helge, you've just found a bug in the shiny new Windows OS
:) Or was this bug aready known before?
 
H

Helge

Thanks for answering. Hopefully some Microsoft guy will check and tell us
something about this.
 
E

Elp

Helge said:
Thanks for answering. Hopefully some Microsoft guy will check and tell us
something about this.

i'm sure that there is a place on the microsoft site where you can fill a
bug report. Don't know where though, i've never been involved with that.
 

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