Microsoft.Extensions.Logging.Console link The object is not installed in the object instance.

 class Program
{
    static void Main(string[] args)
    {
        ILoggerFactory loggerFactory = new LoggerFactory().AddConsole();
        ILogger logger = loggerFactory.CreateLogger<Program>();
        logger.LogInformation(
          "This is a test of the emergency broadcast system.");

    }
}

When I run this code, I get an Object link not set to the exception object instance in the CreateLogger method. If I change .AddConsole (0 to .AddDebug (), it works without errors. So what am I missing? Do I need to add something to the .config file?

+4
source share

All Articles