Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Microsoft.Extensions.Logging or use abstraction. #171

Closed
niemyjski opened this issue Apr 29, 2020 · 9 comments
Closed

Upgrade Microsoft.Extensions.Logging or use abstraction. #171

niemyjski opened this issue Apr 29, 2020 · 9 comments

Comments

@niemyjski
Copy link

I'm getting a type load exception with 3.0.1 and I have no direct dependencies on Microsoft.Extensions.Logging The only dependency I can see is coming from this library. Currently only .NET Core 3.1 is supported (https://dotnet.microsoft.com/platform/support/policy/dotnet-core) would it be possible to bump deps with a new release?

System.TypeLoadException: Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
  at at Microsoft.Extensions.Logging.Logger.BeginScope[TState](TState state)
  at at Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.BeginScope[TState](TState state)
@nblumhardt
Copy link
Member

Hi Blake, thanks for the note, which TFM are you targeting?

@Numpsy
Copy link
Member

Numpsy commented Apr 29, 2020

Same issue as #158?

@skomis-mm
Copy link

skomis-mm commented Apr 30, 2020

Yes, the same issue #158
@niemyjski , it means the binary version of Microsoft.Extensions.Logging is different (<3.0.0) from .Abstractions version (3.1.3).
Why it happens:
Serilog.Extensions.Logging -> Microsoft.Extensions.Logging (2.0.0) -> Microsoft.Extensions.Logging.Abstractions (2.0.0)
<LibraryProject> -> Microsoft.Extensions.Logging.Abstractions (3.1.3)

If you not add reference for Microsoft.Extensions.Logging package, the result of nuget dependency resolution will be:
Microsoft.Extensions.Logging (2.0.0)
Microsoft.Extensions.Logging.Abstractions (3.1.3)

I would suggest in this case if your library targets Abstractions package it is better for long term to target the least version possible unless you need specific API from higher version or have compatibility issues. Or add reference to Microsoft.Extensions.Logging (3.1.3) package to the end project

@niemyjski
Copy link
Author

Yep, same issue.

@niemyjski
Copy link
Author

Any updates on this?

@bodisov
Copy link

bodisov commented Dec 1, 2020

Any update on this?

@abakumov-v
Copy link

@skomis-mm Hi!

Thanks, your suggestion works fine for me 👍

@sungam3r
Copy link
Contributor

@nblumhardt close?

@nblumhardt
Copy link
Member

Thanks @sungam3r 👍 fixed in #223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants