Skip to content

Run OpenSSL error-layout tests only on OpenSSL-supported platforms - #137406

Merged
rzikm merged 1 commit into
dotnet:mainfrom
krwq:krwq-tvos-openssl-test-fix
Nov 13, 2026
Merged

rzikm merged 1 commit into
dotnet:mainfrom
krwq:krwq-tvos-openssl-test-fix

Conversation

@krwq

@krwq krwq commented Nov 12, 2026

Copy link
Copy Markdown
Member

Summary

Replace [Theory] on OpenSslErrorTests.GetSslLibraryReason_UsesLayoutOfLoadedOpenSsl with [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsOpenSslSupported))].

This changes only the test's platform eligibility. Production code and all nine input cases remain unchanged.

The issue's CI investigation reports this exact failure in seven of ten sampled builds, plus follow-up build 1661087, affecting both tvOS-arm64 CoreCLR and NativeAOT. This establishes at least eight affected builds, not a 70% failure rate: the remaining sampled builds lacked matching logs and were not confirmed passes. The issue's automated daily and weekly counts also include a different test, so they are not a reliable frequency measure for this failure.

Failure and rationale

The tvOS failure is a native-library initialization failure, not an incorrect decoded error value. The console for build 1659071 reports 136 tests: 124 passed, nine failed, and three ignored. All nine cases of this theory fail with TypeInitializationException for Interop.OpenSsl, caused by CryptoInitializer failing to load libSystem.Security.Cryptography.Native.OpenSsl.

Although GetSslLibraryReason performs managed bit operations, calling it triggers the explicit static constructor on Interop.OpenSsl. That constructor initializes the native OpenSSL library before the helper can execute. The native build deliberately selects System.Security.Cryptography.Native.Apple for Apple platforms instead of the OpenSSL implementation, so the OpenSSL shim is not an expected dependency on tvOS.

The existing PlatformDetection.IsOpenSslSupported predicate identifies Linux excluding Android, FreeBSD, illumos, and Solaris. It is false on tvOS and the other Apple platforms. Conditioning the theory on this predicate prevents an unsupported OpenSSL initialization attempt while retaining the complete error-layout coverage on OpenSSL-supported platforms. Both OpenSSL error layouts are supplied explicitly by the existing test data, independently of the installed OpenSSL version.

This is not a library-availability check or an exception-based skip: a missing OpenSSL shim on a supported platform will still fail the test. The same conditional-theory predicate is already used by TlsSessionTests.

Validation

  • git diff --check — passed.
  • .\build.cmd clr+libs -rc release — failed on the unchanged baseline with MSVC C1083, Cannot open compiler generated file: '': Invalid argument, while compiling NativeAOT data-descriptor code. This failure preceded the test edit.
  • No post-change build or test run was performed. The local host is Windows, has no Xcode/tvOS execution environment, and has no installed WSL environment. Static inspection supports the diagnosis, but does not establish a successful before/after tvOS result.

Before merging, validate the unchanged and patched unit suite on tvOS under both CoreCLR and NativeAOT: the theory should be skipped before OpenSSL initialization, and the remaining applicable tests should continue to run. On Linux, run all nine cases and require them to pass to confirm that supported-platform coverage remains active.

Fixes #136952

Note

This pull request description was generated with GitHub Copilot.

@azure-pipelines

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

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

@rzikm rzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@rzikm
rzikm enabled auto-merge (squash) November 12, 2026 09:35
@rzikm

rzikm commented Nov 13, 2026

Copy link
Copy Markdown
Member

/ba-g test failure is unrelated

@rzikm
rzikm disabled auto-merge November 13, 2026 08:53
@rzikm
rzikm merged commit e5e6139 into dotnet:main Nov 13, 2026
82 of 86 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci-scan] Test failure: OpenSslErrorTests.GetSslLibraryReason_UsesLayoutOfLoadedOpenSsl on tvOS

4 participants