Console.Writeline() hangs IDE?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I just recently noticed that when I start my applicatoin in debug mode, the IDE
hangs (no disk or CPU activity) indefinitely (at least 20 minutes). Pausing the
application shows that it's hung up at a line in a referenced assembly, one of
my own, which is a simple Console.WriteLine() statement. The stack trace shows
this line one level under the current frame, which is displayed as [<Non-user
Code>].

Anyone seen this behavior before, know what causes it?

TIA,
Bob
 
* "Bob said:
I just recently noticed that when I start my applicatoin in debug mode, the IDE
hangs (no disk or CPU activity) indefinitely (at least 20 minutes). Pausing the
application shows that it's hung up at a line in a referenced assembly, one of
my own, which is a simple Console.WriteLine() statement. The stack trace shows
this line one level under the current frame, which is displayed as [<Non-user
Code>].

Anyone seen this behavior before, know what causes it?

Never seen before. Does that only occur at /one/ call to
'Console.WriteLine' or does this even occur in, for example, a blank or
a very simple project?
 
Herfried K. Wagner said:
Never seen before. Does that only occur at /one/ call to
'Console.WriteLine' or does this even occur in, for example, a blank or
a very simple project?

Yes. This will cause a hang (as described in my original post) at iteration 20
in the loop below.

Module Main

Public Sub Main()
For i As Integer = 1 To 20
Console.WriteLine("console writeline output " & i)
Next
End Sub

End Module

The problem seems to be related to the amount of data sent to the console,
beacuse the loop below causes a hang at 11:

For i As Integer = 1 To 11
Console.WriteLine("console writeline output console writeline output console
writeline output " & i)
Next

If I make another simple project with a form and do Console.Writeline on a
button click, none of the output shows up until the application exits. And if
this output exceeds a ciritcal limit, it hangs just like in the first project.

I'd really like to know what's up with this one. But if no one else can
reproduce it, maybe I'll just have to reinstall VS.

Bob
 
Bob,

Rather than play the "hit or miss" game... test your theory by instantiating
various string with a fixed number of characters such as: Dim test As String
= New String("X",2048) Choose a large value (20 times the length of your
current string for instance) and see if it is in fact the length of the
output. Then reduce the value by half until it doesn't fail. You should be
able to hit the exact length if that is a factor.

What it sounds like (but who knows what it really is) is that the output is
being redirected to some device (like an empty parallel or serial port) and
when that buffer gets full the process blocks waiting for acknowledgement.

Did it ever work? Did it just start doing it out of the blue or is this a
recent installation?

Tom
 
927 is the magic number.

This is not a new installation, yet it just started happening recently.

Bob

Module Main

Public Sub Main()
Dim test As String = New String("X"c, 927)
Console.WriteLine(test)
End Sub

End Module
 
Back
Top