Skip to content

Fix source-build reference assembly leak from OpenTelemetry dependency - #9803

Merged
mthalman merged 1 commit into
dotnet:release/11.0.1xx-rc2from
mthalman:dev/mthalman/super-tribble
Sep 28, 2026
Merged

mthalman merged 1 commit into
dotnet:release/11.0.1xx-rc2from
mthalman:dev/mthalman/super-tribble

Conversation

@mthalman

@mthalman mthalman commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

OpenTelemetry 1.18.0 introduces a transitive dependency on Microsoft.Extensions.Configuration.EnvironmentVariables 10.0.0, allowing a source-build reference assembly to leak into the SDK. Pin it centrally to the existing flowed MicrosoftExtensionsConfigurationIniPackageVersion so it uses the current runtime implementation instead.

Reproduction

Set DOTNET_CLI_TELEMETRY_OPTOUT=0 to enable telemetry and invoke the affected SDK's managed CLI with --version. During startup, TelemetryClient builds an OpenTelemetry provider, which calls AddEnvironmentVariables and attempts to load the reference assembly:

System.TypeInitializationException:
  The type initializer for 'Microsoft.DotNet.Cli.Program' threw an exception.
System.BadImageFormatException:
  Microsoft.Extensions.Configuration.EnvironmentVariables, Version=10.0.0.0
  Reference assemblies cannot be loaded for execution. (0x80131058)

Telemetry defaults off in the tested source-built SDK, so leaving the variable unset or setting it to 1 avoids this path. Setting OTEL_SDK_DISABLED=true does not avoid the failure because OpenTelemetry resolves configuration before checking that setting.

Validation

Source-built SDK Telemetry disabled Telemetry enabled
Before: 11.0.100-rc.2.26476.104 --version succeeds Reference-assembly load failure
With fix: 11.0.100-rc.2.26478.101 --version succeeds --version succeeds

Inspected the actual shipped SDK-root DLL: the original has ReferenceAssemblyAttribute and source=source-build-reference-packages metadata; the patched output has neither marker.

Execution was verified using the shipped managed CLI assemblies on the Windows .NET runtime, not an end-to-end CentOS or NativeAOT run.

Use the flowed Configuration.Ini package version to lift OpenTelemetry's transitive EnvironmentVariables dependency and prevent reference assembly leakage into the SDK.

Co-authored-by: Copilot App <[email protected]>
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team September 28, 2026 16:27
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@mthalman
mthalman enabled auto-merge (squash) September 28, 2026 18:44
@mthalman
mthalman merged commit 0710df3 into dotnet:release/11.0.1xx-rc2 Sep 28, 2026
11 checks passed
@mthalman
mthalman deleted the dev/mthalman/super-tribble branch September 28, 2026 19:19
@mthalman

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx

@mthalman

Copy link
Copy Markdown
Member Author

/backport to main

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to main (link to workflow run)

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

Successfully merging this pull request may close these issues.

2 participants