Skip to content

Conversation

@rolfbjarne
Copy link
Member

Hopefully fixes:

MonoTouchFixtures.CoreWlan.CWKeychainTests
	[FAIL] TrySetWiFiEAPIdentityTest :   ImportPkcs12
  Expected: Success
  But was:  DuplicateItem
		   at MonoTouchFixtures.Security.IdentityTest.GetIdentity() in /Users/builder/azdo/_work/1/s/macios/tests/monotouch-test/Security/IdentityTest.cs:line 25
		   at MonoTouchFixtures.CoreWlan.CWKeychainTests.TrySetWiFiEAPIdentityTest() in /Users/builder/azdo/_work/1/s/macios/tests/monotouch-test/CoreWlan/CWKeychainTests.cs:line 94

Because 'SecImportExport.ImportPkcs12' will by default on macOS import into an
existing keychain (and is thus subject to 'DuplicateItem' problems); while
'SecIdentity.Import' will try to avoid using an existing keychain if
possible (which it is on macOS 15+, or all other platforms).

…ing to do the same thing.

Hopefully fixes:

    MonoTouchFixtures.CoreWlan.CWKeychainTests
    	[FAIL] TrySetWiFiEAPIdentityTest :   ImportPkcs12
      Expected: Success
      But was:  DuplicateItem
    		   at MonoTouchFixtures.Security.IdentityTest.GetIdentity() in /Users/builder/azdo/_work/1/s/macios/tests/monotouch-test/Security/IdentityTest.cs:line 25
    		   at MonoTouchFixtures.CoreWlan.CWKeychainTests.TrySetWiFiEAPIdentityTest() in /Users/builder/azdo/_work/1/s/macios/tests/monotouch-test/CoreWlan/CWKeychainTests.cs:line 94

Because 'SecImportExport.ImportPkcs12' will by default on macOS import into an
existing keychain (and is thus subject to 'DuplicateItem' problems); while
'SecIdentity.Import' will try to avoid using an existing keychain if
possible (which it is on macOS 15+, or all other platforms).
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies test code for creating a SecIdentity instance by replacing manual SecImportExport.ImportPkcs12 calls with the higher-level SecIdentity.Import API. This change addresses test flakiness caused by DuplicateItem errors on macOS, where SecImportExport.ImportPkcs12 imports into the default keychain by default, leading to duplicate entries across test runs.

Key Changes:

  • Replaced 6 lines of manual PKCS#12 import code with a single call to SecIdentity.Import
  • Eliminates explicit NSDictionary/NSString setup and error handling from test helper method
  • Leverages SecIdentity.Import's built-in platform handling (uses in-memory keychain on macOS 15+)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #f449a5b] Build passed (Build packages) ✅

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #f449a5b] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2
Copy link
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: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [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
Collaborator

✅ [CI Build #f449a5b] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f449a5b] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f449a5b] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f449a5b] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #f449a5b] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build #f449a5b] Tests on macOS arm64 - Mac Sequoia (15) failed ❌

Failed tests are:

  • monotouch-test

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #f449a5b] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 2 tests failed, 115 tests passed.

Failures

❌ monotouch tests (macOS) [attempt 5]

2 tests failed, 7 tests passed.

Failed tests

  • monotouch-test/macOS/Debug: Failed (Test run failed.
    Tests run: 3412 Passed: 3227 Inconclusive: 7 Failed: 1 Ignored: 184)
  • monotouch-test/macOS/Debug (managed static registrar): Failed (Test run failed.
    Tests run: 3409 Passed: 3225 Inconclusive: 7 Failed: 1 Ignored: 183)

Html Report (VSDrops) Download

Successes

✅ 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. [attempt 3] Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 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

Pipeline on Agent
Hash: f449a5bbfb1d2b35f68e0bd98b18d500c01d0522 [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants