lcha
asked on
Visual Studio 2008 debug.print not displaying output to immediate window
Hello,
I am trying to debug visual basic .net code using Visual Studio 2008. The project is set up in configuration mode as "debug".
I have a try and catch statement in the code. When I run the code (f8), it errors out midway and goes to the Catch statement but it skips over the debug.print statement and nothing diplays in immediate window. I can put a debug.print anywhere in the code and it's just gets skipped over.
Please advise any insight for what the problem could be. Thanks!
I am trying to debug visual basic .net code using Visual Studio 2008. The project is set up in configuration mode as "debug".
I have a try and catch statement in the code. When I run the code (f8), it errors out midway and goes to the Catch statement but it skips over the debug.print statement and nothing diplays in immediate window. I can put a debug.print anywhere in the code and it's just gets skipped over.
Please advise any insight for what the problem could be. Thanks!
Catch ex As Exception
Debug.Print(ex.Message)
Finally
objWriter.WriteLine("Finishing Process at " & TimeOfDay)
objWriter.Flush()
objWriter.Close()
objWriter = Nothing
End Try
End Sub
The immediate window is showing:
Step into: Stepping over non-user code 'System.ComponentModel.Design.RuntimeLicenseContext.GetLocalPath'
Step into: Stepping over non-user code 'System.ComponentModel.Design.RuntimeLicenseContext.GetSavedLicenseKey'
Step into: Stepping over non-user code 'System.ComponentModel.LicenseManager.LicenseInteropHelper.GetCurrentContextInfo'
Step into: Stepping over non-user code 'System.ComponentModel.LicenseManager.LicenseInteropHelper.GetCurrentContextInfo'
Step into: Stepping over non-user code 'System.ComponentModel.LicenseManager.LicenseInteropHelper.GetCurrentContextInfo'
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.VisualBasic.dll
Step into: Stepping over non-user code 'Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError'
Step into: Stepping over non-user code 'Microsoft.VisualBasic.DateAndTime.TimeOfDay.get'
Step into: Stepping over non-user code 'System.IO.StreamWriter.Flush'
Step into: Stepping over non-user code 'System.IO.StreamWriter.Close'
Step into: Stepping over non-user code 'Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly'
Step into: Stepping over non-user code 'System.Threading.ExecutionContext.Run'
ASKER
I believe it release version ... unless I don't properly understand how to verify it. See the screenshot for the configuration mgr.
F8 is the button I click to begin stepping thru the code line by line.
configmgr.png
F8 is the button I click to begin stepping thru the code line by line.
configmgr.png
See where it says "Active solution configuration"? That says "Debug", which is what you want.
Which language are you using? Which version of Visual Studio (year?, Express?)?
Which language are you using? Which version of Visual Studio (year?, Express?)?
ASKER
visual studio 2008 Professional Edition
From the Tools menu, choose Options.
Click on Debugging in the left panel. Click General.
Scroll down. Is "Redirect all Output Window text to the Intermediate Window" checked?
Click on Debugging in the left panel. Click General.
Scroll down. Is "Redirect all Output Window text to the Intermediate Window" checked?
Or choose "Output" from the View menu and look at the end of the Output tab.
ASKER
Is "Redirect all Output Window text to the Intermediate Window" checked?
- this is checked
The "View" menu doesn't have an option for "Output"
- I see output if I go to Debug --> Windows ---> Output... if I click here though the window is empty.
- this is checked
The "View" menu doesn't have an option for "Output"
- I see output if I go to Debug --> Windows ---> Output... if I click here though the window is empty.
I'm using C#. Apparently the menu layout is different. Also, single-step is different (F10 instead of F8).
When "Redirect..." is not checked for me, Debug.Print writes to the Output window; when checked, Intermediate. You might try unchecking it to see whether anything appears in Output.
Can you set a breakpoint on the Debug.Print statement?
When "Redirect..." is not checked for me, Debug.Print writes to the Output window; when checked, Intermediate. You might try unchecking it to see whether anything appears in Output.
Can you set a breakpoint on the Debug.Print statement?
ASKER
I set the breakpoint but once the code starts running, it skips past the breakpoint and stops on the line after where I had set the breakpoint.
The red dot that marks the breakpoint also gets shifted down one.
The red dot that marks the breakpoint also gets shifted down one.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, I found it after looking around a while.
followed your instructions Project Menu --> xxx Properties
I went to the "Compile" tab and then Advanced Compile options and found the check box you mentioned.
After checking it, the debug.print works! thank you!
followed your instructions Project Menu --> xxx Properties
I went to the "Compile" tab and then Advanced Compile options and found the check box you mentioned.
After checking it, the debug.print works! thank you!
You're welcome. Curiously, that flag does not seem to matter in C#. It was off in my project.
What is F8?