serilog-sinks-http: Incompatibility with asp.net core 2.x
Describe the bug
- Serilog.Sinks.Http 7.2.0/8.0.0-beta.7 both can’t be installed to asp.net core 2.x on dotnet 2.x project with error message:
Severity Code Description Project File Line Suppression State
Error NU1107 Version conflict detected for Microsoft.Extensions.Configuration. Install/reference Microsoft.Extensions.Configuration 3.1.9 directly to project netcore21aspnetcore to resolve this issue.
netcore21aspnetcore -> Serilog.Sinks.Http 7.2.0 -> Microsoft.Extensions.Configuration (>= 3.1.9)
netcore21aspnetcore -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.Extensions.Configuration (>= 2.1.1 && < 2.2.0). netcore21aspnetcore C:\Users\user\RiderProjects\ComatCheck\netcore21aspnetcore\netcore21aspnetcore.csproj 1
- Serilog.Sinks.Http 8.0.0-beta.7 with asp.net core 2.x on net46+ project causes runtime exception during start:
System.TypeLoadException: Could not load type 'Microsoft.Extensions.Primitives.InplaceStringBuilder' from assembly 'Microsoft.Extensions.Primitives, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at Microsoft.Net.Http.Headers.DateTimeFormatter.ToRfc1123String(DateTimeOffset dateTime, Boolean quoted)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.DateHeaderValueManager.SetDateValues(DateTimeOffset value)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.DateHeaderValueManager.OnHeartbeat(DateTimeOffset now)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.Heartbeat.OnHeartbeat()
(Additional context - https://github.com/dotnet/aspnetcore/issues/27986)
. To Reproduce First case:
dotnet new webapp --framework netcoreapp2.1 -o superproj
cd superproj
dotnet add package serilog.sinks.http
Second case: Visual Studo => New Project => ASP.NET Core Web App => “Run on .NET Framework” checkbox => Add “Serilog.Sinks.Http 8.0.0-beta.7” => Run project
Reason Reason for both cases- too high lower version of Microsoft.Extensions.Configuration.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Change minimal required version of Microsoft.Extensions.Configuration Fixes https://github.com/FantasticFiasco/serilog-sinks-http/issues/208 — committed to AntonSmolkov/serilog-sinks-http by AntonSmolkov 3 years ago
- Change minimum required version of Microsoft.Extensions.Configuration Fixes https://github.com/FantasticFiasco/serilog-sinks-http/issues/208 — committed to AntonSmolkov/serilog-sinks-http by AntonSmolkov 3 years ago
- fix: Microsoft.Extensions.Configuration.Abstractions version (#209) * Change minimum required version of Microsoft.Extensions.Configuration Fixes https://github.com/FantasticFiasco/serilog-sinks-h... — committed to FantasticFiasco/serilog-sinks-http by AntonSmolkov 3 years ago
Yes, it’s not an uncomplicated problem to support
Microsoft.Extensions.Configuration
it seems. I will investigate how other packages manages to support it.Another solution I’ve been thinking about the last couple of days is to remove the transient dependency altogether. That instead of passing in a
IConfiguration
implementation to the sink, one could pass aFunc<string, string>
, which basically has the same functionality as theMicrosoft.Extensions.Configuration
package.