Bug in the framework?

W

Wayne

Running V1.1 with latest SP (1 right?), on Windows XP. I have the following
in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can click
items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I know
the example is unlikely that you would do something like this, but what if
the web service really takes this long? Also if I call the web service as
Async I see the same issue when the messagebox gets displayed.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
W

Wayne

Just ran a quick search on Microsoft's site and all I found was SP2 for 1.0,
not for 1.1.

Hazz said:
haven't run the code you included below but aren't we at SP2 as the
atest? -hazz

Wayne said:
Running V1.1 with latest SP (1 right?), on Windows XP. I have the
following
in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can
click
items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I know
the example is unlikely that you would do something like this, but what if
the web service really takes this long? Also if I call the web service as
Async I see the same issue when the messagebox gets displayed.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute.
But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
W

Wayne

Well I actually got it narrowed down some more. It has nothing to do with
the web service. It is just the windows form application.

Drop a timer on the form, set it's interval to 1000 and put this in for the
timer event:

timer1.Enabled = false;
MessageBox.Show("TEST");


Run the application and make sure to take focus away from the form/App. I
just select my News reader. Once you do this and the message box displays
the form is selectable.
 
H

Hazz

sorry Wayne...i wuz thinking XP, not .NET sp's.....

Wayne said:
Just ran a quick search on Microsoft's site and all I found was SP2 for
1.0,
not for 1.1.

Hazz said:
haven't run the code you included below but aren't we at SP2 as the
atest? -hazz

Wayne said:
Running V1.1 with latest SP (1 right?), on Windows XP. I have the
following
in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can
click
items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I know
the example is unlikely that you would do something like this, but what if
the web service really takes this long? Also if I call the web service as
Async I see the same issue when the messagebox gets displayed.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a
minute.
But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
J

Joakim Karlsson

Wayne,

If you change that to

MessageBox.Show(this, "TEST");

you will see the correct behaviour.

Regards,
Joakim
Well I actually got it narrowed down some more. It has nothing to do with
the web service. It is just the windows form application.

Drop a timer on the form, set it's interval to 1000 and put this in for the
timer event:

timer1.Enabled = false;
MessageBox.Show("TEST");


Run the application and make sure to take focus away from the form/App. I
just select my News reader. Once you do this and the message box displays
the form is selectable.




Running V1.1 with latest SP (1 right?), on Windows XP. I have the
following

in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can
click

items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I know
the example is unlikely that you would do something like this, but what if
the web service really takes this long? Also if I call the web service as
Async I see the same issue when the messagebox gets displayed.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute.
But

let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
W

Wayne

Cool, but shouldn't it still work either way? I mean if the form never loses
focus it works just fine. I will defiantly keep this in mind for later
reference.


Joakim Karlsson said:
Wayne,

If you change that to

MessageBox.Show(this, "TEST");

you will see the correct behaviour.

Regards,
Joakim
Well I actually got it narrowed down some more. It has nothing to do with
the web service. It is just the windows form application.

Drop a timer on the form, set it's interval to 1000 and put this in for the
timer event:

timer1.Enabled = false;
MessageBox.Show("TEST");


Run the application and make sure to take focus away from the form/App. I
just select my News reader. Once you do this and the message box displays
the form is selectable.




Running V1.1 with latest SP (1 right?), on Windows XP. I have the
following

in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can
click

items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I know
the example is unlikely that you would do something like this, but what if
the web service really takes this long? Also if I call the web service as
Async I see the same issue when the messagebox gets displayed.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute.
But

let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
W

Wayne

Also with the way it works if you don't pass "this" you can close the form,
leaving the message box, and closing the message box afterwards leaves the
application running.


Wayne said:
Cool, but shouldn't it still work either way? I mean if the form never loses
focus it works just fine. I will defiantly keep this in mind for later
reference.


Joakim Karlsson said:
Wayne,

If you change that to

MessageBox.Show(this, "TEST");

you will see the correct behaviour.

Regards,
Joakim
for
form/App.
I
just select my News reader. Once you do this and the message box displays
the form is selectable.





Running V1.1 with latest SP (1 right?), on Windows XP. I have the

following

in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can

click

items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I know
the example is unlikely that you would do something like this, but
what
 
J

Joakim Karlsson

Hmm...

MessageBox.Show internally calls the private MessageBox.ShowCore method.
This method checks the owner window passed to it. If this method is
null, it uses the active window as parent and calls the native
MessageBox function.

Does seem a bit strange. Perhaps you should post this on a winforms
group instead. Maybe someone there can shed some light on this.

Regards,
Joakim
Also with the way it works if you don't pass "this" you can close the form,
leaving the message box, and closing the message box afterwards leaves the
application running.


Cool, but shouldn't it still work either way? I mean if the form never
loses

focus it works just fine. I will defiantly keep this in mind for later
reference.


Wayne,

If you change that to

MessageBox.Show(this, "TEST");

you will see the correct behaviour.

Regards,
Joakim

Wayne wrote:

Well I actually got it narrowed down some more. It has nothing to do
with

the web service. It is just the windows form application.

Drop a timer on the form, set it's interval to 1000 and put this in
for
the

timer event:

timer1.Enabled = false;
MessageBox.Show("TEST");


Run the application and make sure to take focus away from the
form/App.
I

just select my News reader. Once you do this and the message box
displays

the form is selectable.






Running V1.1 with latest SP (1 right?), on Windows XP. I have the

following


in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can

click


items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I
know

the example is unlikely that you would do something like this, but
what
if

the web service really takes this long? Also if I call the web service
as

Async I see the same issue when the messagebox gets displayed.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a
minute.
But


let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
J

Joakim Karlsson

"If this method is null, " should of course read "If the owner window is
null, "

Time to go to bed :)

Regards,
Joakim

Joakim said:
Hmm...

MessageBox.Show internally calls the private MessageBox.ShowCore method.
This method checks the owner window passed to it. If this method is
null, it uses the active window as parent and calls the native
MessageBox function.

Does seem a bit strange. Perhaps you should post this on a winforms
group instead. Maybe someone there can shed some light on this.

Regards,
Joakim
Also with the way it works if you don't pass "this" you can close the
form,
leaving the message box, and closing the message box afterwards leaves
the
application running.


Cool, but shouldn't it still work either way? I mean if the form never

loses

focus it works just fine. I will defiantly keep this in mind for later
reference.



Wayne,

If you change that to

MessageBox.Show(this, "TEST");

you will see the correct behaviour.

Regards,
Joakim

Wayne wrote:

Well I actually got it narrowed down some more. It has nothing to do


with

the web service. It is just the windows form application.

Drop a timer on the form, set it's interval to 1000 and put this in

for

the

timer event:

timer1.Enabled = false;
MessageBox.Show("TEST");


Run the application and make sure to take focus away from the

form/App.

I

just select my News reader. Once you do this and the message box


displays

the form is selectable.






Running V1.1 with latest SP (1 right?), on Windows XP. I have the


following


in a web service:

[WebMethod()]
public Double Factorial(int n )
{
double n1 = 1;
double result = 1;
while (n1 <= n)
{
result = result * n1;
n1 = n1 + 1;
}

System.Threading.Thread.Sleep(10000);

return result;
}


In my client Code I have under a button click:
MessageBox.Show(CSService.Factorial(20).ToString());

When the messageBox displays the main form is still selectable, I can


click


items on the form, close the form etc...

If I put the sleep down to 100 the messagebox is displayed modally. I


know

the example is unlikely that you would do something like this, but

what

if

the web service really takes this long? Also if I call the web
service


as

Async I see the same issue when the messagebox gets displayed.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a

minute.

But


let him sit on a hot stove for a minute and it's longer than any
hour.
That's relativity." - Albert Einstein
 

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

Similar Threads

TollBox Pushpin effect 2
Beta 2 News Groups 1
windows form datagrid questions 2
XmlSerializer 3
Profiling tool for C# and .net 2.0 2
Formless application 11
XmlCodeExporter 3
///Summary <-- help file generation 2

Top