-
Notifications
You must be signed in to change notification settings - Fork 532
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
[Microsoft.Android.Sdk.ILLink] preserve types with IJniNameProviderAttribute
#9099
Merged
jonathanpeppers
merged 5 commits into
dotnet:main
from
jonathanpeppers:PreserveIJniNameProviderAttribute
Jul 15, 2024
Merged
[Microsoft.Android.Sdk.ILLink] preserve types with IJniNameProviderAttribute
#9099
jonathanpeppers
merged 5 commits into
dotnet:main
from
jonathanpeppers:PreserveIJniNameProviderAttribute
Jul 15, 2024
Conversation
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
…ttribute` Fixes: dotnet#8940 Context: TobiasBuchholz/Plugin.Firebase#144 Using the NuGet package: <PackageReference Include="Plugin.Firebase.CloudMessaging" Version="3.0.0" /> Includes a service: namespace Plugin.Firebase.CloudMessaging.Platforms.Android; [Service(Exported = true)] [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })] public class MyFirebaseMessagingService : FirebaseMessagingService Unfortunately, using `TrimMode=full` completely trims away the above service, which is required for push notifications to work. I could reproduce this problem in a test using the above NuGet package. To fix this, we can modify `MarkJavaObjects` to preserve types with attributes that implement `Java.Interop.IJniNameProviderAttribute`, and the new test now passes.
jonathanpeppers
commented
Jul 11, 2024
Comment on lines
+30
to
+37
if (Profile.IsSdkAssembly (assembly)) | ||
return false; | ||
if (Profile.IsProductAssembly (assembly)) | ||
return false; | ||
|
||
return assembly.MainModule.HasTypeReference ("System.Net.Http.HttpMessageHandler") || | ||
assembly.MainModule.HasTypeReference ("Java.Lang.Object") || | ||
assembly.MainModule.HasTypeReference ("Android.Util.IAttributeSet"); |
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.
Checking IsSdkAssembly()
, IsProductAssembly()
, and Java.Lang.Object
is what the FixAbstractMethodsStep
is already doing, so it seemed appropriate here.
jonathanpeppers
commented
Jul 11, 2024
....Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64XFormsDotNet.apkdesc
Outdated
Show resolved
Hide resolved
dellis1972
approved these changes
Jul 12, 2024
grendello
added a commit
that referenced
this pull request
Jul 23, 2024
* main: (23 commits) Localized file check-in by OneLocBuild Task (#9129) [ci] Disable CodeQL on CI/PR pipelines (#9128) Refine 16k page alignment support (#9075) [build] fix `ConfigureLocalWorkload` target (#9124) Bump to NDK r27 (#9020) [ci] Use drop service for SDK insertion artifacts (#9116) Fix up all mapping paths (#9121) [ci] Fix maestro publishing for stable packages (#9118) Bump to dotnet/sdk@2f14fea98b 9.0.100-preview.7.24367.21 (#9108) Missing androidx.window.[extensions|sidecar] warnings (#9085) [ci] Use sign-artifacts template for macOS signing (#9091) [ci] Use DotNetCoreCLI to sign macOS files (#9102) [ci] Disable CodeQL on macOS, Linux, non-main jobs (#9111) [tests] re-enable `JavaAbstractMethodTest` (#9097) [Microsoft.Android.Sdk.ILLink] preserve types with `IJniNameProviderAttribute` (#9099) [Mono.Android] Data sharing and Close() overrides (#9103) [AndroidManifest] Add `Android.App.PropertyAttribute` (#9016) [Mono.Android] Add support for AndroidMessageHandler ClientCertificates (#8961) [Mono.Android] Bind and enumify API-35 (#9043) Bump to dotnet/java-interop@7a058c0e (#9066) ...
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: #8940
Context: TobiasBuchholz/Plugin.Firebase#144
Using the NuGet package:
Includes a service:
Unfortunately, using
TrimMode=full
completely trims away the above service, which is required for push notifications to work.I could reproduce this problem in a test using the above NuGet package.
To fix this, we can modify
MarkJavaObjects
to preserve types with attributes that implementJava.Interop.IJniNameProviderAttribute
, and the new test now passes.