0

I have a VB.NET application that I run in debug mode. I have 3 lines

    Dim sValue$
    sValue = "test"

    Debug.Print sValue

When I am not running, I set a breakpoint on the lines sValue = "test", and on the line Debug.Print sValue.

Now when I start debugging, the breakpoint on the line Debug.Print sValue disappears, and the Debug.Print is not performed. However, the breakpoint on the line sValue = "test" stays there.

Does anybody know what might go wrong here?

tmighty
  • 10,734
  • 21
  • 104
  • 218

2 Answers2

1

Switching from x86 to AnyCPU helped. Strange.

tmighty
  • 10,734
  • 21
  • 104
  • 218
1

Community,

Here is another solution for those who are using Visual Studio 2012 (Express) for Desktop. Basically, you will need to import the system diagnostics and include a specific line of code. See below:

Imports System.Diagnostics


'Write Your Code Here

Trace.Listeners.Add(New TextWriterTraceListener(Console.Out))

    Debug.Print(Today)     'This will print the date in "Short" form | Carriage Return
    Debug.Write(Today)     'This will print the date in "Long" form
    Trace.Write(Today)     'This will print the date in "Long" form

That's it. That very first line of code is necessary so that Visual Studio will recognize the Debug & Trace classes. The 2nd line of code is needed so that the window will actually display what you need. The final three lines of code do the exact same thing, essentially.

One more thing, make sure that you are in the Output Window's "Debug" page in order to see the printout!

One last thing, if you are a rookie [like me] please make sure that you hit F5 instead of CTRL+F5 if you want Visual Studio to display "Debug.Print" in your output window.


PS. There was a way to get the output to appear in the Immediate Window; but I changed my settings and now it won't appear. So, if you'd like it there you can tinker around with the options and you'll eventually get it.

Elias
  • 723
  • 3
  • 11
  • 18