Skip to content

Remove experimental AndroidGenerateJniMarshalMethods feature - #11128

Merged
jonathanpeppers merged 4 commits into
mainfrom
jonathanpeppers/dev-peppers-remove-jni-marshal-methods
Apr 16, 2026
Merged

Remove experimental AndroidGenerateJniMarshalMethods feature#11128
jonathanpeppers merged 4 commits into
mainfrom
jonathanpeppers/dev-peppers-remove-jni-marshal-methods

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Description

The $(AndroidGenerateJniMarshalMethods) property was an experimental feature that has been completely broken for a long time -- the MSBuild target just emitted an error:

<Error Text="%24(AndroidGenerateJniMarshalMethods)=True is not supported at this time." />

This PR removes all the dead code associated with this feature. If someone still sets the property in their project file, it simply does nothing.

Changes

  • Removed the _GenerateJniMarshalMethods target and its reference from _LinkAssemblies dependencies
  • Removed the default property declaration and property cache entry from Xamarin.Android.Common.targets
  • Deleted ResolveJdkJvmPath.cs -- an MSBuild task that only existed for this feature
  • Removed the ResolveJdkJvmPath UsingTask and invocation from Xamarin.Android.Tooling.targets
  • Simplified PreserveRegistrations.cs by removing PreserveJniMarshalMethods() and the marshal method preservation logic
  • Removed 5 JNI marshal method extension methods from Extensions.cs (GetMarshalMethodsType, TryGetBaseOrInterfaceRegisterMember, IsEqual, TryGetMarshalMethod, GetMarshalMethodName)
  • Updated docs to note the feature was removed in .NET 11
  • Removed RJJ task prefix from the messages index

Checklist

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests -- no new tests needed; this is pure removal of dead code

jonathanpeppers and others added 2 commits April 16, 2026 10:41
The AndroidGenerateJniMarshalMethods feature was experimental and
completely broken (the target just emitted an error). Remove all
code checking for the property, the _GenerateJniMarshalMethods
target, the ResolveJdkJvmPath task (only used by this feature),
and the related JNI marshal method extension methods.

The property can still be set in project files but will have no
effect.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 15:46
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the long-broken experimental $(AndroidGenerateJniMarshalMethods) feature and its associated MSBuild targets/tasks, leaving the property as a no-op for backwards compatibility.

Changes:

  • Removed the _GenerateJniMarshalMethods MSBuild target and all build/task wiring that supported AndroidGenerateJniMarshalMethods.
  • Deleted the ResolveJdkJvmPath MSBuild task and removed its usage from Xamarin.Android.Tooling.targets.
  • Simplified linker preservation logic and updated documentation/message-prefix index to reflect the feature removal in .NET 11.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Tooling.targets Removes ResolveJdkJvmPath task registration/invocation and updates header comment.
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets Removes the feature property default/cache entry and drops _GenerateJniMarshalMethods from build dependencies.
src/Xamarin.Android.Build.Tasks/Tasks/ResolveJdkJvmPath.cs Deletes the task used exclusively by the removed feature.
src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/Extensions.cs Removes JNI marshal-method-related extension helpers now unused.
src/Microsoft.Android.Sdk.ILLink/PreserveRegistrations.cs Removes marshal-method preservation path; preserves only registered methods.
Documentation/docs-mobile/messages/index.md Removes the RJJ task prefix entry.
Documentation/docs-mobile/building-apps/build-properties.md Updates docs to state the feature was removed in .NET 11 and is now a no-op.

Comment thread src/Microsoft.Android.Sdk.ILLink/PreserveRegistrations.cs Outdated
Comment thread src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers
jonathanpeppers merged commit 4296716 into main Apr 16, 2026
6 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers/dev-peppers-remove-jni-marshal-methods branch April 16, 2026 17:58
@github-actions github-actions Bot locked and limited conversation to collaborators May 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants