getsentry/sentry-dotnet

No debug logs on MAUI when launching within Visual Studio

bruno-garcia opened this issue · 3 comments

From a customer cc @JLuse

Similar to ASP.NET (.NET Framework), developers usually run the app from within Visual Studio and there's no console anywhere.
To get the data within the debugging panels of Visual Studio, one can't use Console.WriteLine. And instead requires Trace.WriteLine.

We're aware of that and changed the default on ASP.NET:

options.DiagnosticLogger ??= new TraceDiagnosticLogger(options.DiagnosticLevel);

We need to at least document this for MAUI users on Visual Studio. Or, if we can, figure out at runtime if we're on Visual Studio or not and toggle between Console and Trace.

We need to at least document this for MAUI users on Visual Studio. Or, if we can, figure out at runtime if we're on Visual Studio or not and toggle between Console and Trace

Could we create a ConsoleAndTraceDiagnosticLogger and use that as default? That would work everywhere right?

Would that logger be aware of where to output stuff? Or just write to both?

Would that logger be aware of where to output stuff? Or just write to both?

I think it would have to write to both. I haven't found a reliable way to know which IDE might have spawned a debug session.