Skip to content

[release/8.0-staging] Make TestKeyRing.CreateECDsa resilient to transient macOS OSStatus -50 failures - #134461

Merged
ViveliDuCh merged 1 commit into
dotnet:release/8.0-stagingfrom
ViveliDuCh:backport/pr-125909-to-release/8.0-staging
Sep 23, 2026
Merged

ViveliDuCh merged 1 commit into
dotnet:release/8.0-stagingfrom
ViveliDuCh:backport/pr-125909-to-release/8.0-staging

Conversation

@ViveliDuCh

@ViveliDuCh ViveliDuCh commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Backport of #125909 to release/8.0-staging

/cc @ViveliDuCh

Customer Impact

  • Customer reported
  • Found internally

Sporadic CI test failures across the System.Security.Cryptography.Cose.Tests suite on macOS, caused by the Apple Security framework intermittently returning OSStatus error -50 ("Unsupported key type: 73") when importing EC keys used by shared test fixtures. This is a test-only reliability fix; it does not affect shipped product behavior.

Regression

  • Yes
  • No

Not a product regression; it's a flaky-test fix already merged to main (#125909, itself fixing #121902) and to release/10.0 (#132252).

Testing

Verified by inspection against the merged main fix. The automated backport bot failed to cherry-pick #125909 because TestKeyRing.cs (introduced by a later refactor) doesn't exist on release/8.0-staging; the CreateECDsa helper this PR needs to fix still lives in CoseTestHelpers.cs here. This PR applies the identical retry logic to that location.

Risk

Low. Test only change.

IMPORTANT: If this backport is for a servicing release, please verify that:

  • For .NET 8 and .NET 9: The PR target branch is release/X.0-staging, not release/X.0.
  • For .NET 10+: The PR target branch is release/X.0 (no -staging suffix).

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.

…0 failures

Backport of dotnet#125909 to release/8.0-staging.

The automated backport failed because TestKeyRing.cs (introduced by a
later refactor) does not exist on this branch; the CreateECDsa helper
still lives in CoseTestHelpers.cs here. This applies the same fix
(retry ECDsa.Create up to 3 times on macOS when it transiently fails
with OSStatus -50 / CryptographicException HResult -50) to that
location instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 22, 2026 21:16
@azure-pipelines

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

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.

Copilot review overview

🟢 Approval recommended

The scoped test-only change has no unresolved blocking issues.

Review effort: Lite
Findings: None

What changed in this PR

This pull request backports a test-only fix that makes COSE ECDSA key creation resilient to transient macOS failures.

Changes:

  • Retries matching macOS cryptographic failures up to three times.
  • Uses RuntimeInformation for compatibility.
File Description
src/​libraries/​System.Security.Cryptography.Cose/​tests/​CoseTestHelpers.cs Adds bounded retry handling for ECDSA creation.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@ViveliDuCh

Copy link
Copy Markdown
Member Author

/ba-g deadletter

@ViveliDuCh ViveliDuCh added the Servicing-approved Approved for servicing release label Sep 23, 2026
@ViveliDuCh

Copy link
Copy Markdown
Member Author

Test only change. Adding servicing-approved.

@ViveliDuCh
ViveliDuCh merged commit 991b913 into dotnet:release/8.0-staging Sep 23, 2026
119 of 127 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Security Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants