Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Forward port of: #10473
Context: https://github.com/jonathanpeppers/IntuneReproNet9
Context: 35f41dc
Context: 9a27140

.NET 9 introduced a Java "instanceof" check for multiple reasons:

if (!JniEnvironment.Types.IsAssignableFrom (handleClass, typeClass)) {
    return null;
}

The problem with this check, is that it fails in combination with the package:

<PackageReference Include="Microsoft.Intune.Maui.Essentials.android" Version="11.0.0-develop" />

LayoutInflater.From (Context) returns null due to:

Handle 0x7f346ad02d is of type 'com/android/internal/policy/PhoneLayoutInflater' which is not assignable to 'com/microsoft/intune/mam/client/view/MAMLayoutInflater'

To solve this:

  • Introduce -p:_AndroidIsAssignableFromCheck=false to disable the check, defaulting to true for .NET 9+.

  • Add a test that calls LayoutInflater.From (Context) and verify it returns non-null.

  • Add a test entry in IsAssignableFromRemaps.xml to remap com.microsoft.intune.mam.client.view.MAMLayoutInflater to a test Java class net.dot.android.test.MyLayoutInflater that extends android.view.LayoutInflater.

I introduced a new test run configuration "IsAssignableFrom" to leverage the new property -p:_AndroidIsAssignableFromCheck=false, and only run the Intune category.

Forward port of: #10473
Context: https://github.com/jonathanpeppers/IntuneReproNet9
Context: 35f41dc
Context: 9a27140

.NET 9 introduced a Java "instanceof" check for multiple reasons:

    if (!JniEnvironment.Types.IsAssignableFrom (handleClass, typeClass)) {
        return null;
    }

The problem with this check, is that it fails in combination with the
package:

    <PackageReference Include="Microsoft.Intune.Maui.Essentials.android" Version="11.0.0-develop" />

`LayoutInflater.From (Context)` returns `null` due to:

    Handle 0x7f346ad02d is of type 'com/android/internal/policy/PhoneLayoutInflater' which is not assignable to
'com/microsoft/intune/mam/client/view/MAMLayoutInflater'

To solve this:

* Introduce `-p:_AndroidIsAssignableFromCheck=false`
  to disable the check, defaulting to `true` for .NET 9+.

* Add a test that calls `LayoutInflater.From (Context)` and
  verify it returns non-null.

* Add a test entry in `IsAssignableFromRemaps.xml` to remap
  `com.microsoft.intune.mam.client.view.MAMLayoutInflater`
  to a test Java class `net.dot.android.test.MyLayoutInflater`
  that extends `android.view.LayoutInflater`.

I introduced a new test run configuration "IsAssignableFrom"
to leverage the new property `-p:_AndroidIsAssignableFromCheck=false`,
and only run the `Intune` category.
@jonathanpeppers
Copy link
Member Author

The test looks good:

image

The full logs are not available to review because all APK tests passed.

I will test locally.

@jonathanpeppers
Copy link
Member Author

The logs locally, look OK:

09-12 10:14:08.643 32064 32086 I DOTNET  : LayoutInflaterTest: RuntimeFeature.IsAssignableFromCheck=False
...
09-12 10:14:08.644 32064 32086 I monodroid-assembly: typemap: unable to find mapping to a managed type from Java type 'com/android/internal/policy/PhoneLayoutInflater'
...
09-12 10:14:08.647 32064 32086 D monodroid: typemap: Java type 'android/view/LayoutInflater' corresponds to managed type 'Android.Views.LayoutInflater, Mono.Android'
...
09-12 10:14:08.650 32064 32086 D monodroid-assembly: Handle 0x71f786f80d is of type 'com/android/internal/policy/PhoneLayoutInflater' which is not assignable to 'net/dot/android/test/MyLayoutInflater'
...
09-12 10:14:08.658 32064 32086 I NUnit   : 	Passed

@jonathanpeppers jonathanpeppers marked this pull request as ready for review September 12, 2025 15:16
@grendello grendello merged commit e72bf36 into main Sep 15, 2025
59 checks passed
@grendello grendello deleted the dev/peppers/net10-remap branch September 15, 2025 09:51
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2025
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.

3 participants