|
-
Jan 27th, 2012, 10:44 AM
#1
Thread Starter
Lively Member
debug.writeline or trace.writeline -- no output
Hi
in VS 2008, I started a new VB console project, using default options. I wrote this simple program:
Module Module1
Sub Main()
Dim ArrayOfInts() As Integer
ArrayOfInts = New Integer() {1, 2, 3, 4, 5, 6, 7, 8, 9}
For i = 0 To ArrayOfInts.Length - 1
Debug.WriteLine(ArrayOfInts(i))
Trace.WriteLine(ArrayOfInts(i)) Next End Sub End Module
...then ran it under debug (I just hit F5)
However, I cannot find the output from the calls to writeline. Not in the Output window, not in the Immediate window and not in the console output. So...where is it going?
Or, do I need to do something extra to get these to appear?
-
Jan 27th, 2012, 07:00 PM
#2
Re: debug.writeline or trace.writeline -- no output
You won't see anything in the Console unless you use the Console.xx methods. You can divert output to the immediate window (or vice-versa) and you also have options when you right click in the output/immediate to show/hide certain things, like exceptions and likely debug lines, check you have not turned them off by accident.
-
Jan 27th, 2012, 10:21 PM
#3
Re: debug.writeline or trace.writeline -- no output
When writing to the Console as shown below and pressing F5 or select Debug to the your console app the console window will appear as a flash. To stop this add a Console.ReadLine or press CTRL+F5 which causes the console app to wait for you to press the a key to continue.
Code:
Module Module1
Sub Main()
Console.WriteLine("See me")
End Sub
End Module
-
Jan 28th, 2012, 01:00 PM
#4
Thread Starter
Lively Member
Re: debug.writeline or trace.writeline -- no output
 Originally Posted by Grimfort
You won't see anything in the Console unless you use the Console.xx methods. You can divert output to the immediate window (or vice-versa) and you also have options when you right click in the output/immediate to show/hide certain things, like exceptions and likely debug lines, check you have not turned them off by accident.
Yeah I get that about the console methods. If I add console.writeline (blabla), I see that as expected.
I am completely unsuccessful in getting any output from the debug.writeline or trace.writeline methods to appear anywhere though. The Immediate and Output windows are empty.
Note that I started a brand new project for this test and left all options at their default settings. I didn't turn any options off by accident.
-
Jan 28th, 2012, 02:59 PM
#5
Re: debug.writeline or trace.writeline -- no output
They are not project settings, they are IDE settings.
-
Jan 28th, 2012, 10:42 PM
#6
Thread Starter
Lively Member
Re: debug.writeline or trace.writeline -- no output
Yes, I know that there are IDE settings. But in this case there all set to their out-of-the-box defaults.
-
Jan 29th, 2012, 12:02 AM
#7
Re: debug.writeline or trace.writeline -- no output
I think it has to do with not using the Visual Studio Hosting Process while debugging? I'm not entirely sure, but see if enabling that [if you have it disabled] fixes the problem.
-
Jan 29th, 2012, 07:48 PM
#8
Thread Starter
Lively Member
Re: debug.writeline or trace.writeline -- no output
I am running this under Visual Studio Hosting Process
-
Jan 30th, 2012, 09:53 AM
#9
Thread Starter
Lively Member
Re: debug.writeline or trace.writeline -- no output
SOLVED it! I had to open the Output window, right click and enable Program Output. Then, the output appeared in the Immediate window.
I call that counter-intuitive.
-
Jan 30th, 2012, 10:10 AM
#10
Re: debug.writeline or trace.writeline -- no output
I did mention that in my first post, glad you got it sorted.
-
Jan 30th, 2012, 02:42 PM
#11
Thread Starter
Lively Member
Re: debug.writeline or trace.writeline -- no output
Yes, I got it sorted, but the solution is mystifying. To summarize, if you want to see the results from debug.writeline or trace.writeline calls when running under the debugger, one must enable the "program output" (not "debug output") in the output window. My expectation would be that debug output would always show when running under the debugger without doing anything special.
-
Jan 30th, 2012, 03:12 PM
#12
Re: debug.writeline or trace.writeline -- no output
They are on by default, at some point in time you likely have turned it off. You can reset the IDE to defaults by a command line I believe, possibly through the IDE somewhere but I have never looked for it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|