Debug.Writeline() not doing new line?

  • Thread starter Thread starter Brett
  • Start date Start date
B

Brett

I use the following to output to the console during debugging:

catch(Exception ex) {
Debug.WriteLine("Error: " + ex.Message);
}

Many of the times on the console, the above is appended on the same line.
Sometimes it goes on a new line. I don't have any thing in my code related
to trace listeners. Any suggestions as to why this is occuring?

Thanks,
Brett
 
Brett said:
I use the following to output to the console during debugging:

catch(Exception ex) {
Debug.WriteLine("Error: " + ex.Message);
}

Many of the times on the console, the above is appended on the same line.
Sometimes it goes on a new line. I don't have any thing in my code
related to trace listeners. Any suggestions as to why this is occuring?

Thanks,
Brett

WriteLine means write the string to the console at the current cursor
location and advance to the next line when done.
It looks like what was written before didn't append a cr/lf, so it was done
using Console.Write.

Willy.
 
Willy Denoyette said:
WriteLine means write the string to the console at the current cursor
location and advance to the next line when done.
It looks like what was written before didn't append a cr/lf, so it was
done using Console.Write.

Willy.

I use Debug.Writeline() and not Write anywhere. Could it be something else?

Thanks,
Brett
 
Brett said:
I use Debug.Writeline() and not Write anywhere. Could it be something
else?

Thanks,
Brett

Not sure what exception is thrown but keep in mind that Debug.WriteLine
displays the string at the "current" cursor position, if that position is
not a the beginning of a new line it means that the last IO was a Write or
the Exception (and the Debug.WriteLine) interferes with a currently
executing Console output.

Willy.
 
Back
Top