I'm debugging a UWP in C#. On a certain moment the console stops giving me the write line content.
Does anyone can imagen what the problem could be?
I'm debugging a UWP in C#. On a certain moment the console stops giving me the write line content.
Does anyone can imagen what the problem could be?
The Console.WriteLine
isn't for IDE output window. It writes to console. So, you could use Debug.WriteLine()
which is available in System.Diagnostics
Console.WriteLine
or Debug.Writeline
are inappropriate for tracing or logging. The real solution is to use a logging library.
The Output Window of the debugger is not the console. If you want to write to it use Debug.WriteLine
. You can do this because the Output Window is registered as a listener for .NET's tracing infrastructure.
This won't work in Release mode though. You'd need to use Trace.WriteLine
for this but you'd also need to register your own listeners. You'd also need to specify message levels to separate errors from verbose messages and eg write only erros to log files.
At this point though, it's just as easy to add and configure a logging library like Serilog or NLog that have providers for rolling files, databases, logging servers etc.
If you wanna see some messages in "Output" you should use Debug.WriteLine
. For this add using System.Diagnostics
.
If you use WindowsForm, for example, you can't just use Console.WriteLine
.
© 2022 - 2024 — McMap. All rights reserved.
Debug.WriteLine
– MagnetiteConsole.WriteLine()
works fine, but for some project it does not. WithWPF + .Net Framework
it works, withWPF + .Net Core 3
it does not. – Almund