Outdated OpenTelemetry NuGet package reference should be upgraded
There are a few outdated package reference in Logzio.DotNet.NLog but one in particular should be upgraded: OpenTelemetry.
The version currently being targeted is 1.3.1 and the most current version, as of this writing, is 1.7.0. The reason why this upgrade is important is that somewhere in the chain of dependencies for the outdated OpenTelemetry package is a reference to System.Diagnostics.DiagnosticSource with the following restriction: (>= 6.0.0 && < 8.0.0).
This means that my C# project can't take a transitive dependency on System.Diagnostics.DiagnosticSource version 8.0.0 (which is the latest released version, as of this writing) and leads to the following error message in Visual Studio:
Version conflict detected for System.Diagnostics.DiagnosticSource. Install/reference System.Diagnostics.DiagnosticSource 8.0.0 directly to project MyProject to resolve this issue.
MyProject -> Microsoft.Extensions.Hosting 8.0.0 -> Microsoft.Extensions.Hosting.Abstractions 8.0.0 -> Microsoft.Extensions.Diagnostics.Abstractions 8.0.0 -> System.Diagnostics.DiagnosticSource (>= 8.0.0)
MyProject -> Logzio.DotNet.NLog 1.1.0 -> OpenTelemetry 1.3.1 -> OpenTelemetry.Api 1.3.1 -> System.Diagnostics.DiagnosticSource (>= 6.0.0 && < 8.0.0).
As the error message indicates, I can work around this problem by taking an implicit dependency on the latest System.Diagnostics.DiagnosticSource but my project does not really need a direct reference to this package and I would be adding this reference simply to overcome the fact that somewhere in Logzio.DotNet.NLog's chain of dependencies there is a restriction on which version of System.Diagnostics.DiagnosticSource can be used.
Rather than force myself (and other developers) to implement the workaround I just mentioned, why not fix the root of the problem which is a reference to an outdated version of the OpenTelemetry nuget package?
Please note that Visual Studio displays the following warning after you apply the workaround: Detected package version outside of dependency constraint: OpenTelemetry.Api 1.3.1 requires System.Diagnostics.DiagnosticSource (>= 6.0.0 && < 8.0.0) but version System.Diagnostics.DiagnosticSource 8.0.0 was resolved.
It's just a warning and it can be safely ignored, but it may be problematic if your csproj is configured to treat warnings as errors like so:
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Hi @Jericho,
Thanks for pointing this out and for the detailed explanation. We've just merged a PR (#75) that updates the OpenTelemetry package in net8.0. You can now get version 1.2.0 from NuGet, which should fix the dependency issue with System.Diagnostics.DiagnosticSource 8.0.0.
Please let us know if it resolves your issue and if you run into any more problems. Appreciate your patience!
Excellent. Thanks for letting me know.