Skip to content
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

[Mono.Android] fix trimming warnings, part 2 #8758

Merged
merged 6 commits into from
Mar 1, 2024

Commits on Feb 23, 2024

  1. [Mono.Android] fix trimming warnings, part 2

    This fixes the next set of trimmer warnings found via:
    
        <IsTrimmable>true</IsTrimmable>
        <EnableAotAnalyzer>true</EnableAotAnalyzer>
    
    ~~ JavaObjectExtensions ~~
    
    `JavaCast<T>()` now requires `PublicConstructors` and
    `NonPublicConstructors` because of `Activator.CreateInstance<T>()`.
    This change bubbles up to various other types that have a
    `Find*ById<T>()` method:
    
    * `Activity`
    * `Dialog`
    * `FragmentManager`
    * `View`
    * `Window`
    
    `GetInvokerType()` also has suppressions around `Assembly.GetType()`
    and `Type.MakeGenericType()`. We track this for the future at:
    
    dotnet#8724
    
    ~~ AndroidRuntime ~~
    
    Update `[DynamicallyAccessedMembers]` based on changes to
    `RegisterNativeMembers` in:
    
    dotnet/java-interop@b8f6f88
    
    ~~ JNINativeWrapper ~~
    
    `$(EnableAotAnalyzer)` found usage of `DynamicMethod`. Suppress for now,
    as we track this for the future at:
    
    dotnet#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.
    
    ~~ 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. Not really much we can do yet, except rely on
    `MarkJavaObjects` trimmer step.
    
    Likely also a problem for the future:
    
    dotnet#8724
    jonathanpeppers committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    2b6a0bf View commit details
    Browse the repository at this point in the history

Commits on Feb 26, 2024

  1. Configuration menu
    Copy the full SHA
    991674c View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2024

  1. Update JavaProxyThrowable.cs

    Code comments + FIXME
    jonathanpeppers committed Feb 27, 2024
    Configuration menu
    Copy the full SHA
    6fab46c View commit details
    Browse the repository at this point in the history
  2. #pragma warning disable IL3050

    Doing it this way, keeps the warning present if someone was attempting to *use* NativeAOT, they still get the warning.
    jonathanpeppers committed Feb 27, 2024
    Configuration menu
    Copy the full SHA
    4234ebb View commit details
    Browse the repository at this point in the history

Commits on Feb 29, 2024

  1. Update FragmentManager.cs

    Code formatting
    jonpryor committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    2f89efa View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c61f027 View commit details
    Browse the repository at this point in the history