The output window disappears when I'm debugging

  • Thread starter Thread starter gemel
  • Start date Start date
G

gemel

I am debugging code that writes to the console window, I select an
appropriate line and the select 'Run to Cursor'. The console output
does appear and then the window closes. How can I keep this window
open without having to put Console.ReadLine() statements in my code?

Regards

John L
 
Hi,

The problem is how the application works, a console application doesn't have
any message process by default, so your app is just a linear program, starts
and finishes.

If you want to see what is going on you need to stop the thread, one way is
using as you said Console.Read() or ReadLine(), this pauses the application
until you press a key, this is good practice and all console applications
that present user interface or messages works in this way.

Put a breakpoint instead of "Run to Cursor", it works better for debugging.
Otherwise you have to thing if a console application is the right choice for
you. You can simulate an event handler creating an application loop but the
entries are only based on the Console objects so you don't have any message
to process (like windows ones).

Hope this helps to understand
Best regards
Salva
 
Back
Top