Skip to content

[msbuild] Bump Xamarin.MacDev and use PDictionary.[Try]OpenFile.#25382

Open
rolfbjarne wants to merge 2 commits into
mainfrom
dev/rolf/msbuild-pdictionary-openfile
Open

[msbuild] Bump Xamarin.MacDev and use PDictionary.[Try]OpenFile.#25382
rolfbjarne wants to merge 2 commits into
mainfrom
dev/rolf/msbuild-pdictionary-openfile

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne commented May 11, 2026

Use the new PDictionary.OpenFile (throws on failure) and PDictionary.TryOpenFile (returns false on failure) APIs instead of the older PDictionary.FromFile which could return null.

  • FromFile(...)! → OpenFile(...) for code expecting success
  • try/catch { FromFile } with fallback → TryOpenFile where appropriate
  • Removed dead null checks after OpenFile (it never returns null)

Use the new PDictionary.OpenFile (throws on failure) and
PDictionary.TryOpenFile (returns false on failure) APIs instead of the older
PDictionary.FromFile which could return null.

- FromFile(...)! → OpenFile(...) for code expecting success
- try/catch { FromFile } with fallback → TryOpenFile where appropriate
- Removed dead null checks after OpenFile (it never returns null)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
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 updates msbuild tasks and tests to use the newer PDictionary.OpenFile (throwing) and PDictionary.TryOpenFile (non-throwing) APIs instead of PDictionary.FromFile, aligning plist-loading behavior with explicit success vs failure expectations.

Changes:

  • Replaced PDictionary.FromFile(...) with PDictionary.OpenFile(...) in code paths that expect plist loading to succeed.
  • Replaced try/catch + fallback patterns with PDictionary.TryOpenFile(...) where failure is acceptable and should not throw.
  • Removed null-handling that was only necessary when FromFile could return null.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/common/Driver.cs Switches plist loading to OpenFile after an existence check.
tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs Uses TryOpenFile to fail tests cleanly when Info.plist can’t be loaded.
tests/msbuild/Xamarin.MacDev.Tests/TargetTests/CollectAppManifestsTests.cs Uses OpenFile when the app manifest plist is expected to exist and parse.
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs Uses OpenFile for XCFramework test plist resources.
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/IBToolTaskTests.cs Uses OpenFile to read MinimumOSVersion from Info.plist.
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs Uses OpenFile for compiled manifest plist loading in tests.
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs Uses OpenFile for compiled/archived entitlements plist assertions.
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileAppManifestTaskTests.cs Uses OpenFile for compiled app manifest plist assertions.
tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ACToolTaskTest.cs Uses OpenFile for partial app manifest plist in ACTool tests.
tests/dotnet/UnitTests/TestBaseClass.cs Uses OpenFile to read entitlements output from codesign.
tests/dotnet/UnitTests/ProjectTest.cs Uses OpenFile for various Info.plist reads in dotnet unit tests.
tests/dotnet/UnitTests/PartialAppManifestTest.cs Uses OpenFile for Info.plist validation after builds.
tests/dotnet/UnitTests/MauiTest.cs Uses OpenFile for Info.plist validation in MAUI test builds.
msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs Uses OpenFile when parsing tool output manifests for warnings/errors.
msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAssetPackManifest.cs Uses OpenFile for the asset pack manifest template.
msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifest.cs Uses OpenFile for the first manifest (inside existing error handling).
msbuild/Xamarin.MacDev.Tasks/Tasks/ValidateAppBundle.cs Uses OpenFile to load bundle Info.plist files during validation.
msbuild/Xamarin.MacDev.Tasks/Tasks/ReadAppManifest.cs Uses OpenFile for the input app manifest plist.
msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs Uses TryOpenFile for entitlements inspection without exception control flow.
msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs Uses TryOpenFile for validating/deleting malformed log plists; uses OpenFile for manifest parsing.
msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValue.cs Uses OpenFile for the primary plist load inside existing try/catch.
msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableName.cs Uses OpenFile for app manifest parsing.
msbuild/Xamarin.MacDev.Tasks/Tasks/GetMlaunchArguments.cs Uses OpenFile to read device family from the manifest.
msbuild/Xamarin.MacDev.Tasks/Tasks/GetAvailableDevices.cs Uses OpenFile to read the bundle manifest when it exists.
msbuild/Xamarin.MacDev.Tasks/Tasks/FilterStaticFrameworks.cs Uses TryOpenFile when reading framework Info.plist for CFBundleExecutable.
msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentity.cs Uses OpenFile to check whether entitlements are present.
msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackage.cs Uses OpenFile and removes unreachable null checks after plist load.
msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettings.cs Uses OpenFile to read debug settings plist if present.
msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifest.cs Uses TryOpenFile when iterating ODR pack Info.plist files.
msbuild/Xamarin.MacDev.Tasks/Tasks/CompileProductDefinition.cs Uses OpenFile and removes unreachable null checks after plist load.
msbuild/Xamarin.MacDev.Tasks/Tasks/CompileITunesMetadata.cs Uses OpenFile to load iTunes metadata plists.
msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlements.cs Uses OpenFile for default/project entitlements and archived-entitlements comparison.
msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs Uses OpenFile for base and partial plist template loading.
msbuild/Xamarin.MacDev.Tasks/Tasks/Codesign.cs Uses OpenFile to read CFBundleExecutable from Info.plist.
msbuild/Xamarin.MacDev.Tasks/Tasks/Archive.cs Uses OpenFile for various manifest reads during archive creation.
msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs Uses OpenFile to parse ACTool manifest output for warnings/errors.

Comment thread tests/dotnet/UnitTests/TestBaseClass.cs
Comment thread msbuild/Xamarin.MacDev.Tasks/Tasks/FilterStaticFrameworks.cs
@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

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.

@rolfbjarne rolfbjarne marked this pull request as ready for review May 15, 2026 07:10
@rolfbjarne rolfbjarne requested a review from mauroa as a code owner May 15, 2026 07:10
@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

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

Pipeline on Agent
Hash: 979e5017b038fcd2be97bd76b2c27541c8442129 [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

✅ [PR Build #979e501] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 979e5017b038fcd2be97bd76b2c27541c8442129 [PR build]

@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: 979e5017b038fcd2be97bd76b2c27541c8442129 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #979e501] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 979e5017b038fcd2be97bd76b2c27541c8442129 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🔥 [CI Build #979e501] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

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

Failures

❌ monotouch tests (macOS)

2 tests failed, 16 tests passed.

Failed tests

  • monotouch-test/macOS/Release (static registrar): Failed (Test run failed.
    Tests run: 3709 Passed: 3592 Inconclusive: 8 Failed: 1 Ignored: 116)
  • monotouch-test/macOS/Release (static registrar, all optimizations): Failed (Test run failed.
    Tests run: 3709 Passed: 3596 Inconclusive: 7 Failed: 4 Ignored: 109)

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 Publish failed ⚠️) 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 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 16 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 16 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: 979e5017b038fcd2be97bd76b2c27541c8442129 [PR build]

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.

3 participants