Skip to content

[monotouch-test] Fix TOCTOU race in SecProtocolMetadataTest.TlsDefaults. Fixes #25877. - #26186

Merged
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/issue-25877-ci-flaky-secprotocolmetadatatest-tlsdef-f0093c
Jul 20, 2026
Merged

rolfbjarne merged 1 commit into
mainfrom
dev/rolf/issue-25877-ci-flaky-secprotocolmetadatatest-tlsdef-f0093c

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

The mitigation for the flaky ServerName check read the live native
s.ServerName property twice: once for the null-check that triggers
IgnoreInCI, and again in the Assert.That equality check. The two
native reads could disagree (e.g. transient network proxy interference),
so the first read returning non-null would skip the IgnoreInCI while
the second returned null and hard-failed the assertion.

Cache the value once and use it for both the null-check and the
assertion, closing the race.

Fixes #25877

πŸ€– Pull request created by Copilot

…ts. Fixes #25877.

The mitigation for the flaky ServerName check read the live native
s.ServerName property twice: once for the null-check that triggers
IgnoreInCI, and again in the Assert.That equality check. The two native
reads could disagree (e.g. transient network proxy interference), so the
first read returning non-null would skip the IgnoreInCI while the second
returned null and hard-failed the assertion.

Cache the value once and use it for both the null-check and the
assertion, closing the race.

Fixes #25877

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d4363538-c2f8-4288-bda5-28061cc2f110

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a TOCTOU race in the SecProtocolMetadataTest.TlsDefaults flaky test by caching SecProtocolMetadata.ServerName once, so the CI-ignore null-check and the assertion operate on the same value.

Changes:

  • Read s.ServerName into a local serverName variable once.
  • Use the cached serverName for both the IgnoreInCI null-check and the equality assertion.

@rolfbjarne
rolfbjarne marked this pull request as ready for review July 20, 2026 12:31
@rolfbjarne
rolfbjarne enabled auto-merge (squash) July 20, 2026 12:31
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

βœ… API diff for current PR / commit

NET (empty diffs)

βœ… API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 46ac21469d6aac38821585dcb98bc892d03ea6d2 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

πŸš€ [CI Build #46ac214] Test results πŸš€

Test results

βœ… All tests passed on VSTS: test results.

πŸŽ‰ All 203 tests passed πŸŽ‰

Tests counts

βœ… assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
βœ… cecil: All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
βœ… dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
βœ… framework: All 2 tests passed. Html Report (VSDrops) Download
βœ… fsharp: All 4 tests passed. Html Report (VSDrops) Download
βœ… generator: All 5 tests passed. Html Report (VSDrops) Download
βœ… interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
βœ… introspection: All 4 tests passed. Html Report (VSDrops) Download
βœ… linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
βœ… linker (MacCatalyst): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
βœ… linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
βœ… linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
βœ… monotouch (iOS): All 19 tests passed. Html Report (VSDrops) Download
βœ… monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
βœ… monotouch (macOS): All 19 tests passed. Html Report (VSDrops) Download
βœ… monotouch (tvOS): All 19 tests passed. Html Report (VSDrops) Download
βœ… msbuild: All 2 tests passed. Html Report (VSDrops) Download
βœ… sharpie: All 1 tests passed. Html Report (VSDrops) Download
βœ… windows: All 3 tests passed. Html Report (VSDrops) Download
βœ… xcframework: All 4 tests passed. Html Report (VSDrops) Download
βœ… xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

βœ… Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
βœ… Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

βœ… Linux build succeeded

Pipeline on Agent
Hash: 46ac21469d6aac38821585dcb98bc892d03ea6d2 [PR build]

@rolfbjarne
rolfbjarne merged commit d62e9b9 into main Jul 20, 2026
53 of 57 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/issue-25877-ci-flaky-secprotocolmetadatatest-tlsdef-f0093c branch July 20, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] Flaky: SecProtocolMetadataTest.TlsDefaults β€” ServerName is null

4 participants