-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] AndroidLinkResources and Styleables (#7306
) Fixes: #7194 Context: dotnet/maui#7038 The initial version of `$(AndroidLinkResources)` (9e6ce03) was too broad in its removal of Resource classes and fields. Certain fields such as `Styleable` arrays were not called using the IL `stsfld` opcode. As a result they could not be easily replaced with constant usage. However, the linker removed *all* the fields from the `Resource` nested types. This would result in the following error at runtime: System.BadImageFormatException: 'Could not resolve field token 0x0400000b' This was because the `int[]` fields were removed as part of the linking process. Fix this by leaving the `int[]` fields in the `Resource` nested types instead of removing them. We can still remove all the other `int` fields. We now also need to fix up the `Resource` nested type constructors to replace the `int` field access with the constant values like we do for the rest of the app. This was not required previously because these constructors were removed, but now we have to keep them because the static array initialization takes place in these constructors.
- Loading branch information
1 parent
93411cf
commit d521ac0
Showing
8 changed files
with
190 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<declare-styleable name="MyLibraryWidget"> | ||
<attr name="library_bool_attr" format="boolean" /> | ||
<attr name="library_int_attr" format="integer" /> | ||
</declare-styleable> | ||
</resources> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<declare-styleable name="MyWidget"> | ||
<attr name="bool_attr" format="boolean" /> | ||
<attr name="int_attr" format="integer" /> | ||
</declare-styleable> | ||
</resources> |
This file contains 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
This file contains 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
This file contains 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