opentelemetry-dotnet-instrumentation icon indicating copy to clipboard operation
opentelemetry-dotnet-instrumentation copied to clipboard

Version mismatch

Open Kielek opened this issue 1 year ago • 5 comments
trafficstars

Same issue here. Where the project, or dependant projects, have direct dependencies on Microsoft.Extensions.* 6.0, we are having Could not load file or assembly issues. Adding OpenTelemetry.AutoInstrumentation nuget package does not solve the issue.

I am not familiar on how the injection mechanism work, but why a net6 project should hard reference Microsoft.Extensions 7.* packages? Shouldn't be that depending on the target framework, the dependancy is >= [targetframework].*

Originally posted by @federicobarera in https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/issues/3075#issuecomment-1832168095

Kielek avatar Nov 30 '23 08:11 Kielek

@federicobarera, could you please create Minimal, Reproducible Example? It should include all steps you are using to build the package.

Kielek avatar Nov 30 '23 08:11 Kielek

Hi, you can find a repro with instructions here: https://github.com/federicobarera/otel-auto-repro

image

federicobarera avatar Dec 01 '23 08:12 federicobarera

To resolve an issue, you have to either remove this package reference or update it to version 7.0.0: <PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> in the https://github.com/federicobarera/otel-auto-repro/blob/master/Dependencies/Dependencies.csproj. We are aware of the root cause of the issue and will address the application crash issue in the next version. Instead of crashing the app, it should safely back off and provide more detailed information in the log files to aid in fixing the issue.

rajkumar-rangaraj avatar Dec 01 '23 17:12 rajkumar-rangaraj

@rajkumar-rangaraj, @Kielek

I have a couple more questions regarding this issue.

EDIT:

  1. The Troubleshooting docs mention that adding OpenTelemetry.AutoInstrumentation should auto resolve the versioning issues. This is not happening. Is this a bug or an intended behavior/limitation. As we are planning adoption across tens of teams and projects I am trying to assess the effort required in getting auto instrumentation working.

  2. net8. We also had compatibility issues with projects runing net8 and the 0.43 operator (referencing 1.11 AutoInstrumentation Assembly -> Microsoft.Extensions 7.x). Given the next verson (1.12) is referencing 8.x Microsoft.Ex, are all applications expected to adopt 8.x Microsoft.Ex dependencies? Do you know when the next operator is going to support the next version of the auto instrumentation?

  3. We hoped for an initial no-code changes adoption of otel. The assembly conflicts seem to indicate that this is not going to be the case. Is there any future plan for the auto-instrumentation to be able to work with both net6/8 using whatever version of assemblies is available in the runtime?

federicobarera avatar Dec 01 '23 22:12 federicobarera

@federicobarera OpenTelemetry .NET SDK has reference to old version of Microsoft.Extensions.Logging.Configuration. Hence the usage of NuGet did not help.

  "OpenTelemetry/1.6.0": {
    "dependencies": {
      "Microsoft.Extensions.Logging.Configuration": "3.1.0",
      "OpenTelemetry.Api.ProviderBuilderExtensions": "1.6.0"
    },
    "runtime": {
      "lib/net6.0/OpenTelemetry.dll": {
        "assemblyVersion": "1.0.0.0",
        "fileVersion": "1.6.0.1006"
      }
    }
  },

Next Version (1.7) version of OpenTelemetry .NET SDK has 8.0.0. version of Microsoft.Extensions.Logging.Configuration. When auto-instrumentation takes reference to next version of OpenTelemetry .NET SDK, this issue will be resolved. OpenTelemetry .NET SDK might release 1.7 version of SDK next month.

rajkumar-rangaraj avatar Dec 04 '23 18:12 rajkumar-rangaraj