[Trimming] Remove RegisterJniNatives suppression#11435
Closed
simonrozsival wants to merge 2 commits into
Closed
Conversation
Correct the attribute name introduced while removing the RegisterJniNatives trimming suppression so the clean branch builds. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates JNIEnvInit.RegisterJniNatives() to stop suppressing trimming diagnostics around Type.GetType() and instead explicitly annotates the unmanaged callback as trimming-unsafe via RequiresUnreferencedCode, aligning with the goal of removing UnconditionalSuppressMessage usage.
Changes:
- Removed the local
UnconditionalSuppressMessage+DynamicallyAccessedMembers-annotated wrapper aroundType.GetType(). - Added
[RequiresUnreferencedCode]to theRegisterJniNativesunmanaged callback to surface the trimming hazard rather than suppress it.
Member
Author
|
Note: We might want to set |
Member
Author
|
This method is not used with the trimmable typemap and so it will be trimmed out when it's not used with the trimmable type map. I'm closing this now and I won't be looking into this area at this moment. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
UnconditionalSuppressMessagearoundType.GetType()inRegisterJniNatives()RequiresUnreferencedCodeinstead of hiding the reflection warningPart of #10794.
Validation
./dotnet-local.sh build src/Mono.Android/Mono.Android.csproj -v:minimal -nr:falsesucceededIL####) found in the build logNote: this fresh worktree emitted existing generated/baseline warnings unrelated to this one-file change (CS0436/CA1422/RS0025/javac warnings).