-
Notifications
You must be signed in to change notification settings - Fork 516
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
[linker/trimmer] Add opt-in support for not marking NSObjects in user assemblies. Fixes #15723. #17949
[linker/trimmer] Add opt-in support for not marking NSObjects in user assemblies. Fixes #15723. #17949
Conversation
… assemblies. Fixes xamarin#15723. We mark all types that derive from NSObject when we find them in user assemblies, so that these types may be used in storyboards (where the linker can't see them), without having to go through hoops to make sure the linker doesn't remove these types (which would make the storyboard fail to load, because it would reference types that were linked away). However, not everybody uses storyboards, so in some cases it may make sense to link away as much as possible, so make it opt-in to skip this custom marking. This is an experimental feature, and will break at least some apps. It may break most apps, but if someone wants to try it out, they're welcome! Fixes xamarin#15723.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just missing in the PR description or a doc under docs describing how would a user opt in into this experimental feature 👍
@@ -165,6 +168,9 @@ public override bool Execute () | |||
item.SetMetadata ("Value", value.Substring (colon + 1)); | |||
envVariables.Add (item); | |||
break; | |||
case "skip-marking-nsobjects-in-user-assemblies": | |||
SkipMarkingNSObjectsInUserAssemblies = ParseBool (value) ? "false" : "true"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks weird. If the extra arg skip-marking-nsobjects-in-user-assemblies
is true, we set SkipMarkingNSObjectsInUserAssemblies
to false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emaf Good catch! I've now fixed this.
💻 [CI Build] Windows Integration Tests passed 💻✅ All Windows Integration Tests passed. Pipeline on Agent |
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes)
NET (empty diffs)
✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)✅ Generator diffGenerator diff is empty Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻✅ All tests on macOS M1 - Mac Ventura (13.0) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻✅ All tests on macOS M1 - Mac Big Sur (11.5) passed. Pipeline on Agent |
🚀 [CI Build] Test results 🚀Test results✅ All tests passed on VSTS: simulator tests. 🎉 All 225 tests passed 🎉 Tests counts✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
We mark all types that derive from NSObject when we find them in user
assemblies, so that these types may be used in storyboards (where the linker
can't see them), without having to go through hoops to make sure the linker
doesn't remove these types (which would make the storyboard fail to load,
because it would reference types that were linked away).
However, not everybody uses storyboards, so in some cases it may make sense to
link away as much as possible, so make it opt-in to skip this custom marking.
This is an experimental feature, and will break at least some apps. It may
break most apps, but if someone wants to try it out, they're welcome!
It can be turned on by passing
--skip-marking-nsobjects-in-user-assemblies=true
to mtouch/mmp:Fixes #15723.