Debug.Writeline() not doing new line?

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
 
W

Willy Denoyette [MVP]

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.
 
B

Brett

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
 
W

Willy Denoyette [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top