Skip to content

Fix FilterStaticFrameworks task to support custom framework binary names #23045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 13, 2025

The FilterStaticFrameworks MSBuild task was hardcoded to assume framework executables are always located at Framework.framework/Framework, but some frameworks (like FFmpeg's libavcodec) use custom executable paths specified in their Info.plist via the CFBundleExecutable property.

This caused build failures with frameworks that use custom binary names:

error MT158: The file '/path/to/libavcodec.framework/libavcodec' does not exist.

The actual executable was at libavcodec.framework/libavcodec.dylib as specified in the framework's Info.plist CFBundleExecutable property.

Solution

Added a GetFrameworkExecutablePath helper method that:

  1. Reads Info.plist: Checks for CFBundleExecutable property in framework's Info.plist
  2. Uses custom path: Returns the path specified by CFBundleExecutable when present
  3. Falls back gracefully: Uses default behavior for standard frameworks or when Info.plist is missing/corrupt
  4. Maintains compatibility: All existing frameworks continue to work unchanged

Example

Before (fails):

libavcodec.framework/
├── Info.plist  # CFBundleExecutable = "libavcodec.dylib"
└── libavcodec.dylib

Task looks for: libavcodec.framework/libavcodec

After (works):
Task reads Info.plist and looks for: libavcodec.framework/libavcodec.dylib

Testing

Added comprehensive tests covering:

  • ✅ Custom CFBundleExecutable scenarios (reproduces the original issue)
  • ✅ Standard frameworks without Info.plist (backward compatibility)
  • ✅ Non-framework paths (edge case handling)
  • ✅ Error handling for malformed/missing Info.plist files

Fixes #23039.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: rolfbjarne <249268+rolfbjarne@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] FilterStaticFrameworks task doesn't support custom Framework binary names Fix FilterStaticFrameworks task to support custom framework binary names Jun 13, 2025
@Copilot Copilot AI requested a review from rolfbjarne June 13, 2025 18:23
Copilot finished work on behalf of rolfbjarne June 13, 2025 18:23
Comment on lines 31 to 39
try {
var plist = PDictionary.FromFile (infoPlistPath);
var bundleExecutable = plist?.GetCFBundleExecutable ();
if (!string.IsNullOrEmpty (bundleExecutable)) {
return Path.Combine (frameworkPath, bundleExecutable);
}
} catch {
// If reading the plist fails, fall back to the default behavior
}
Copy link
Member

Choose a reason for hiding this comment

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

FromFile does not raise any exception, what exception are you trying to catch? This can me cleaner with a if statement no need for the try/catch.

Copy link
Author

Choose a reason for hiding this comment

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

You're right! I've simplified the code by removing the try-catch and using explicit null checking instead. Since GetFrameworkExecutablePath is called within a larger try-catch block that handles framework validation errors appropriately, any exceptions from PDictionary.FromFile will be caught and logged with proper error messages. The refactored code is cleaner and follows the patterns used elsewhere in the codebase. Fixed in d3f208c.

@@ -20,6 +20,29 @@ public class FilterStaticFrameworks : XamarinTask, ITaskCallback {
[Output]
public ITaskItem []? FrameworkToPublish { get; set; }

static string GetFrameworkExecutablePath (string frameworkPath)
{
if (!frameworkPath.EndsWith (".framework", StringComparison.OrdinalIgnoreCase) || !Directory.Exists (frameworkPath))
Copy link
Member

Choose a reason for hiding this comment

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

Simplify the || to use an and so that it can be short circuit.

Copy link
Author

Choose a reason for hiding this comment

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

Simplified the logical condition to use && with short-circuiting instead of ||. The change is logically equivalent but more efficient - if the path doesn't end with ".framework", we skip the Directory.Exists check entirely. Fixed in 0b203a4.

Co-authored-by: mandel-macaque <2190086+mandel-macaque@users.noreply.github.com>
Co-authored-by: mandel-macaque <2190086+mandel-macaque@users.noreply.github.com>
Copilot finished work on behalf of mandel-macaque June 13, 2025 18:46
@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: cb9e1c42-de13-48b7-b6df-6c5a01d20da4

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 17f50e8e-5c07-48bd-b0a6-bd3ed9a7a89e

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 4be25d47-1581-484e-82e7-970da6b92d8e

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: dcf50cd4-9439-4ec9-992b-43610425540e

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 6c8ca4e4-da9c-4123-b939-726c033e967b

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 4c5bad3c-8c72-4003-b1a0-b90e4818cd77

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 460b4f88-22a1-4115-9f90-a2f89adb4a54

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: fd7cd250-084d-48ff-b855-5c4b90e3eecb

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 20fb05be-412f-4678-b1ce-14fde9bfc0da

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: f4043b59-8586-488d-8edb-a67a5cc2d311

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: c5bd27fb-07c5-479a-9d25-57abb0451e66

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 1fdfb70b-e78c-4550-8e22-a07f664c2376

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

✅ API diff vs stable

.NET ( No breaking changes )

ℹ️ Generator diff

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

Pipeline on Agent
Hash: 0b203a42f74807738bb65675bbc419420a7cd5a2 [PR build]

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 8a7bd78b-a4c6-4960-82ae-a44041e0a2d7

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: d7a61e47-3cb9-43c2-a8a3-917a72ddbd8a

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 7bc843ce-ea16-4926-a626-fac97d95ac24

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: bd743717-bee7-4dac-9a99-fe7caca2fd80

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #d3f208c] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: d3f208c01f8dadc9ddc93fbd67c73e1861cca3ab [PR build]

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 17c4d967-90a2-48a6-a4e9-cdc4f67fe4fe

Sorry for the inconvenience!

@TomEdwardsEnscape
Copy link

This narrowly fixes the problem in the specific MSBuild Task I reported, but are there other places in the toolchain making the same assumption? An integration test which builds a project with a reference to a framework with a non-default binary name is needed.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #0b203a4] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 0b203a42f74807738bb65675bbc419420a7cd5a2 [PR build]

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: e65e38b0-718b-4f87-bcc0-98a93ff02a2c

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 0b203a42f74807738bb65675bbc419420a7cd5a2 [PR build]

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: fc5298ef-8acc-4733-b86d-db3f2bc11880

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 0b203a42f74807738bb65675bbc419420a7cd5a2 [PR build]

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 70310c08-bad7-4e8f-8bb5-0a03ebb45005

Sorry for the inconvenience!

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 0b203a42f74807738bb65675bbc419420a7cd5a2 [PR build]

Copy link
Author

Copilot AI commented Jun 13, 2025

@vs-mobiletools-engineering-service2 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: d8f9586f-17ec-484f-89cd-46198b9e61f1

Sorry for the inconvenience!

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.

FilterStaticFrameworks task doesn't support custom Framework binary names
5 participants