You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This only happens if the runtime is prior to .NET 7.0.4, all others will load a version accepted by the rule. The issue is made more visible via docker because if a cached image of something like mcr.microsoft.com/dotnet/aspnet:7.0 can have an older .NET runtime.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Log with this problem:
2023-09-07T13:23:45.7884573Z] [Debug] Rule Engine: dotnet is not in the exclusion list. ApplicationInExcludeListRule evaluation success.
[2023-09-07T13:23:46.0068444Z] [Information] Rule Engine: MinSupportedFrameworkRule evaluation success.
[2023-09-07T13:23:46.0132213Z] [Information] Rule Engine: OpenTelemetrySdkMinimumVersionRule evaluation success.
[2023-09-07T13:23:46.0782108Z] [Error] Rule Engine: Application has direct or indirect reference to older version of System.Diagnostics.DiagnosticSource.dll 6.0.2123.36311.
[2023-09-07T13:23:46.0826856Z] [Error] Rule 'System.Diagnostics.DiagnosticSource Validator' failed: Ensure that the System.Diagnostics.DiagnosticSource version is not older than the version used by the Automatic Instrumentation
[2023-09-07T13:23:46.3057769Z] [Error] Error in StartupHook initialization: LoaderFolderLocation: /root/.otel-dotnet-auto/net
Exception: Rule Engine Failure: One or more rules failed validation. Automatic Instrumentation won't be loaded.
System.Exception: Rule Engine Failure: One or more rules failed validation. Automatic Instrumentation won't be loaded.
at StartupHook.Initialize() in /project/src/OpenTelemetry.AutoInstrumentation.StartupHook/StartupHook.cs:line 47
Runtime environment (please complete the following information):
.NET version: any .NET release that shipped a version of System.Diganostics.DiagnosticSource smaller than one shipped by auto-instrumentation.
Reproduce
Steps to reproduce the behavior:
Build a console app targeting .NET 7.0 that shipped an version of S.D.DS prior to file version 7.0.423.11508. Disable roll-forward if a .NET runtime with S.D.DS greater than 7.0.423.11508 is available.
Setup auto-instrumentation
Run the console app.
The issue doesn't happen with TFM net6.0 because the AdditionalDeps+SharedStore causes the runtime to load the desired version. The SharedStore for net7.0 doesn't include S.D.DS assembly, since the AdditionalDeps is built using a SDK post+7.0.4, see .
Workarounds
Disable the rules by setting the environment variable OTEL_DOTNET_AUTO_RULE_ENGINE_ENABLED to false.
Update the runtime to the latest 7.* version. If using docker image like mcr.microsoft.com/dotnet/aspnet:7.0 do a docker pull to update the image to the latest runtime.
Root cause
The rule attempts to load a type from S.D.DS using only the name of the assembly, without a version, and before the AssemblyResolve callback is in place. This causes the application to load the version shipped with the runtime.
The text was updated successfully, but these errors were encountered:
pjanotti
changed the title
Rule checking System.Diagnostics.DiagnosticSource version firing on correct configuration
Rule checking System.Diagnostics.DiagnosticSource version for net7.0 failing on correct configuration
Sep 12, 2023
Bug Report
Error log from user shows the issue on net6.0, however, I wasn't able to repro that
Symptom
A correct configuration on .NET 7.0 can result in the rule validating
System.Diganostics.DiagnosticSource
version incorrectly indicating a version problem. Example: https://cloud-native.slack.com/archives/C01NR1YLSE7/p1694097187958009This only happens if the runtime is prior to .NET 7.0.4, all others will load a version accepted by the rule. The issue is made more visible via docker because if a cached image of something like
mcr.microsoft.com/dotnet/aspnet:7.0
can have an older .NET runtime.Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Log with this problem:
Runtime environment (please complete the following information):
System.Diganostics.DiagnosticSource
smaller than one shipped by auto-instrumentation.Reproduce
Steps to reproduce the behavior:
7.0.423.11508
. Disable roll-forward if a .NET runtime with S.D.DS greater than7.0.423.11508
is available.The issue doesn't happen with TFM
net6.0
because the AdditionalDeps+SharedStore causes the runtime to load the desired version. The SharedStore fornet7.0
doesn't include S.D.DS assembly, since the AdditionalDeps is built using a SDK post+7.0.4, see .Workarounds
OTEL_DOTNET_AUTO_RULE_ENGINE_ENABLED
tofalse
.mcr.microsoft.com/dotnet/aspnet:7.0
do adocker pull
to update the image to the latest runtime.Root cause
The rule attempts to load a type from S.D.DS using only the name of the assembly, without a version, and before the
AssemblyResolve
callback is in place. This causes the application to load the version shipped with the runtime.The text was updated successfully, but these errors were encountered: