[XABT] Fix ApplicationAttribute.ManageSpaceActivity manual mapping (#9708)#9729
Merged
jonpryor merged 1 commit intorelease/9.0.1xxfrom Jan 31, 2025
Merged
[XABT] Fix ApplicationAttribute.ManageSpaceActivity manual mapping (#9708)#9729jonpryor merged 1 commit intorelease/9.0.1xxfrom
jonpryor merged 1 commit intorelease/9.0.1xxfrom
Conversation
…9708) Fixes: #9705 Context: 3ab74db When converting `AndroidManifest.xml` attribute mappings in 3ab74db, `ApplicationAttribute.ManageSpaceActivity` was not correctly mapped in the manual mapping. The result is that if the property is used: [assembly: Application(ManageSpaceActivity=typeof(MyManageSpaceActivity))] the build will fail: error XAGJS7007: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Type'. error XAGJS7007: at Android.App.ApplicationAttribute.<>c.<AddManualMapping>b__189_3(ApplicationAttribute self, Object value) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Mono.Android/ApplicationAttribute.Partial.cs:line 47 error XAGJS7007: at Xamarin.Android.Manifest.ManifestDocumentElement`1.Load(T value, CustomAttribute attribute, TypeDefinitionCache cache) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocumentElement.cs:line 127 error XAGJS7007: at Android.App.ApplicationAttribute.FromCustomAttributeProvider(ICustomAttributeProvider provider, TypeDefinitionCache cache) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Mono.Android/ApplicationAttribute.Partial.cs:line 67 error XAGJS7007: at Xamarin.Android.Tasks.ManifestDocument.CreateApplicationElement(XElement manifest, String applicationClass, List`1 subclasses, TypeDefinitionCache cache) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs:line 581 error XAGJS7007: at Xamarin.Android.Tasks.ManifestDocument.Merge(TaskLoggingHelper log, TypeDefinitionCache cache, List`1 subclasses, String applicationClass, Boolean embed, String bundledWearApplicationName, IEnumerable`1 mergedManifestDocuments) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs:line 290 error XAGJS7007: at Xamarin.Android.Tasks.GenerateJavaStubs.MergeManifest(NativeCodeGenState codeGenState, Dictionary`2 userAssemblies) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 363 error XAGJS7007: at Xamarin.Android.Tasks.GenerateJavaStubs.Run(Boolean useMarshalMethods) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 270 error XAGJS7007: at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask() in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs:line 102 error XAGJS7007: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 `ApplicationAttribute.ManageSpaceActivity` needs to follow the pattern other attributes of type `Type` follow, like `ActivityAttribute.ParentActivity`: mapping.Add ( member: "ParentActivity", attributeName: "parentActivityName", getter: self => self._ParentActivity, setter: (self, value) => self._ParentActivity = (string) value, typeof (Type) ); With this change, the reported case in #9705 generates the proper `AndroidManifest` value: <application android:manageSpaceActivity="crc64fe9411caa440e724.MyManageSpaceActivity" … >
dellis1972
requested changes
Jan 30, 2025
Contributor
dellis1972
left a comment
There was a problem hiding this comment.
Looks good, but needs a unit test.
jonathanpeppers
approved these changes
Jan 31, 2025
Member
jonathanpeppers
left a comment
There was a problem hiding this comment.
Since we didn't add a test in #9708 (this one is a backport), it's probably ok to merge this one without a test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #9705
Context: 3ab74db
When converting
AndroidManifest.xmlattribute mappings in 3ab74db,ApplicationAttribute.ManageSpaceActivitywas not correctly mapped in the manual mapping.The result is that if the property is used:
the build will fail:
ApplicationAttribute.ManageSpaceActivityneeds to follow the pattern other attributes of typeTypefollow, likeActivityAttribute.ParentActivity:With this change, the reported case in #9705 generates the proper
AndroidManifestvalue: