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
1554672 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1554343 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1554235 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution #132348
1553120 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1552117 dotnet/runtime System.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext #132274
1552059 dotnet/runtime System.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext #132216
1551332 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1550345 dotnet/runtime System.Net.Security.Tests.SslAuthenticationOptionsTests.UpdateOptions_ServerCertificateContextProvided_DoesNotDisposeCallerContext #132216
1549654 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1549539 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1547725 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution #132112
1547726 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1547473 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution #131783
1546065 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1545668 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1545268 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
1544675 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution #132002
1543815 dotnet/runtime System.Net.Security.Unit.Tests.WorkItemExecution
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 14 20

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 tvOS

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions