Skip to content

[tvOS NativeAOT] UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext fails with InvalidCastException #131921

Description

@matouskozak

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1540423
Build error leg or test failing: tvos-arm64 Release AllSubsets_NativeAOTSystem.Net.Security.Unit.TestsSystem.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext

Error Details

The newly added regression test fails on tvOS NativeAOT while creating its caller-owned certificate context:

[FAIL] System.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext
System.InvalidCastException : Specified cast is not valid.
   at System.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext()
      in /_/src/libraries/System.Net.Security/tests/UnitTests/SslAuthenticationOptionsTests.cs:line 192

Line 192 is the first SslStreamCertificateContext.Create(...) call. The failure occurs before the test reaches SslAuthenticationOptions.UpdateOptions, so it does not directly demonstrate a failure in the ownership fix being tested.

The test was introduced by #131758, which is present in build 1540423 but absent from the preceding build 1538577. This is distinct from the Android failure tracked by #131920: Android throws PlatformNotSupportedException while building an empty custom trust store, whereas tvOS NativeAOT throws InvalidCastException during certificate-context creation.

Test summary:

Tests run: 128 Passed: 124 Inconclusive: 0 Failed: 1 Ignored: 3
XHarness exit code: 1 (TESTS_FAILED)

Error Message

{
  "ErrorMessage": [
    "[FAIL] System.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext",
    "System.InvalidCastException : Specified cast is not valid."
  ],
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Note

This issue was prepared with GitHub Copilot assistance and reviewed by the submitting developer.

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1540423
Error message validated: [[FAIL] System.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext System.InvalidCastException : Specified cast is not valid.]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 8/6/2026 7:27:22 AM UTC

Report

Build Repository Test Pull Request
1542078 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1540423 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
1 2 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Known Build ErrorUse this to report build issues in the .NET Helix tabarea-System.Net.Securityblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'os-tvosApple tvOSuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions