It seems that Debug.Listeners does not exist in .net core

As of .NET Core 3.0, you can use Trace.Listeners instead. It affects Debug too and is functionally equivalent.


It seems that I have no way to solve that problem, but I can debug my application like that:

    public static void a()
    {
        Console.WriteLine("always show");
        DebugLog();
    }
    [System.Diagnostics.ConditionalAttribute("DEBUG")]
    static void DebugLog()
    {
        Console.WriteLine("debug show");
    }

just create a new method and then add [System.Diagnostics.ConditionalAttribute("DEBUG")]

Tags:

C#

.Net Core