Using the ad-hoc test runner in .NET 4.x and earlier, doing a Debug.WriteLine outputs the messages to the Output window. In .NET 5 (and Core) this isn't the case. A workaround is to add Trace.Listeners.Add(new ConsoleTraceListener()) to my code somewhere every time I write an ad-hoc test, but this is a bit of a faff.
🙏 Could a console TraceListener be added to Trace.Listeners in TestDriven.NetCore.AdHoc.dll instead of me having to do it manually each time?
I've decompiled TestDriven.NetCore.AdHoc.dll and added the following code to Program.Main and replaced it:
public static int Main(string[] args)
{
Trace.Listeners.Add(new ConsoleTraceListener());
...
}
class ConsoleTraceListener : TraceListener
{
public override void Write(string message) => Console.Write(message);
public override void WriteLine(string message) => Console.WriteLine(message);
}
Using the ad-hoc test runner in .NET 4.x and earlier, doing a
Debug.WriteLine
outputs the messages to the Output window. In .NET 5 (and Core) this isn't the case. A workaround is to addTrace.Listeners.Add(new ConsoleTraceListener())
to my code somewhere every time I write an ad-hoc test, but this is a bit of a faff.🙏 Could a console TraceListener be added to Trace.Listeners in TestDriven.NetCore.AdHoc.dll instead of me having to do it manually each time?
I've decompiled TestDriven.NetCore.AdHoc.dll and added the following code to Program.Main and replaced it:
And it now works as it does under .NET 4.x