dotnet-core-sdk-beta
dotnet-core-sdk-beta copied to clipboard
Exception with RunEnvironment : Method not found with loggerfactory
Hi I got this exception while running a sample with ASP.Net Core 3.1
: Method not found: 'Microsoft.Extensions.Logging.ILoggerFactory Microsoft.Extensions.Logging.DebugLoggerFactoryExtensions.AddDebug(Microsoft.Extensions.Logging.ILoggerFactory, Microsoft.Extensions.Logging.LogLevel)'.
Also having this issue using .Net Core 3.1
Same here. The issue, I think, is because ApiOperationBase has static Logger instance of type Microsoft.Extensions.Logging.ILogger, that is invoked in the ApiOperationBase constructor. But in case of .Net Core xx there's no way to pass ILogger reference (service?) to it...
Just for other people, I have compiled the code for Core 3.1. The change required is in the LogFactory.cs GetLog method : return new LoggerFactory().CreateLogger(classType.FullName);
That have seems to do the trick. No more error and things seem to work as before. Hope this helps someone.