-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mono.Android] fix trimming warnings, part 2 (#8758)
Context: #5652 Context: #8724 Context: dotnet/java-interop#1165 Context: dotnet/java-interop@b8f6f88 Context: dc3dc3ccf28cdbe9f8c0a705400b83c11a85c81a980ccf2 Fix another set of trimmer warnings found via: <IsTrimmable>true</IsTrimmable> <EnableAotAnalyzer>true</EnableAotAnalyzer> ~~ JavaObjectExtensions ~~ `Extensions.JavaCast<T>()` now requires `PublicConstructors` and `NonPublicConstructors` because `TypeManager.CreateProxy()` uses `ConstructorInfo.Invoke()`. This change bubbles up to various other types that have a `Find*ById<T>()` method: * `Activity` * `Dialog` * `FragmentManager` * `View` * `Window` `JavaObjectExtensions.GetInvokerType()` also has suppressions around `Assembly.GetType()` and `Type.MakeGenericType()`. We track this for the future at #8724. ~~ AndroidRuntime ~~ Update `[DynamicallyAccessedMembers]` based on changes to `RegisterNativeMembers` in dotnet/java-interop@b8f6f888. ~~ JNINativeWrapper ~~ `$(EnableAotAnalyzer)` found usage of `DynamicMethod`. Suppress for now, as we track this for the future at #8724. ~~ ResourceIdManager ~~ Usage of `Type.GetMethod ("UpdateIdValues")` leads to decoration of `[ResourceDesignerAttribute]` with: [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] public string FullName { get; set; } I also had to suppress warnings around `Assembly.GetType()`. This *should* be OK, as `Resource.designer.cs` is always in the "root assembly" of Android application projects. Additionally, this code should no longer be used in .NET 8+ apps; see dc3ccf2. ~~ JavaProxyThrowable ~~ Suppress warning around `StackFrame.GetMethod()`; we already handle `null` return values and exceptions. The existing code appears to be "best effort" to provide additional stack trace information. ~~ TypeManager ~~ Suppress warning around a call to `Type.GetType()` with a string passed in from Java. There is not much we can really do yet, except rely on the `MarkJavaObjects` trimmer step. Likely also a problem for the future: * dotnet/java-interop#1165 * #8724 ~~ Impact on `.apk` size ~~ `BuildReleaseArm64XFormsDotNet.apkdesc` shows a ~33KB size increase in the `.apk`. Much of this is attributable to changes from dotnet/runtime (`System.Private.CoreLib.dll` is ~20KB larger). Some of this is due to increases in the size of `classes*.dex`. These changes are because more managed constructors are now preserved by the trimmer, which causes more constructors to be emitted into the Java Callable Wrappers.
- Loading branch information
1 parent
60dbcc9
commit 5205a5f
Showing
14 changed files
with
214 additions
and
102 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
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
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
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
Oops, something went wrong.