serilog / serilog-extensions-logging

Serilog provider for Microsoft.Extensions.Logging
Apache License 2.0
313 stars 100 forks source link

Suspected incompatibility between Serilog.Extensions.Logging 1.3.0 and Microsoft.AspNetCore.AzureAppServicesIntegration 1.0.0 #61

Closed npnelson closed 7 years ago

npnelson commented 7 years ago

I started upgrading my apps to .NET core 1.1.0 and decided to use the Microsoft.AspNetCore.AzureAppServicesIntegration package. It has a dependency on Microsoft.Extensions.Logging.AzureAppServices which has a dependency on Serilog.Extensions.Logging>=1.0.0.

My apps have a direct dependency on Serilog.Extensions.Logging 1.3.0 and I can't get them to work in Azure. I was able to capture this stacktrace below.

I have a github repo here: https://github.com/npnelson/AzureAppServiceSerilogBug

I'm guessing Serilog.Extensions.Logging removed a method needed by Microsoft.Extensions.Logging.AzureAppServices somewhere along the way.

Unhandled Exception: System.MissingMethodException: Method not found: 'Microsoft.Extensions.Logging.ILoggerFactory Serilog.SerilogLoggerFactoryExtensions.AddSerilog(Microsoft.Extensions.Logging.ILoggerFactory, Serilog.ILogger)'. at Microsoft.Extensions.Logging.AzureAppServices.Internal.AzureAppServicesDiagnosticsLoggerProvider..ctor(WebAppContext context, AzureAppServicesDiagnosticsSettings settings) at Microsoft.Extensions.Logging.AzureAppServicesLoggerFactoryExtensions.AddAzureWebAppDiagnostics(ILoggerFactory factory, AzureAppServicesDiagnosticsSettings settings) at Microsoft.Extensions.Logging.AzureAppServicesLoggerFactoryExtensions.AddAzureWebAppDiagnostics(ILoggerFactory factory) at Microsoft.AspNetCore.Hosting.AppServicesWebHostBuilderExtensions.<>c.<UseAzureAppServices>b__0_0(ILoggerFactory loggerFactory) at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at <Redacted>.Program.Main(String[] args) in C:\agent\_work\5\s\src\<Redacted>\Program.cs:line 15

nblumhardt commented 7 years ago

Thanks for the report, will have a look into it.

nblumhardt commented 7 years ago

Between 1.0 and 1.1 a binary-breaking change was added; I don't think we had many consumers not on the bleeding edge at that time, so there was no major version bump.

The PR #62 reinstates the overload that was removed (though it will be called, it's cloaked behind EditorBrowsableState.Never).

Aiming to merge straight to master.

nblumhardt commented 7 years ago

Version 1.3.1 now on NuGet should fix this.

FYI @pakrym @muratg

npnelson commented 7 years ago

I just rolled out 1.3.1 and everything is working great now. Thanks for the quick response and fix!

muratg commented 7 years ago

Thanks @nblumhardt!