Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[release/9.0.1xx] introduce$(_AndroidIsAssignableFromCheck) escape hatch#10473

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jonathanpeppers merged 6 commits intorelease/9.0.1xxfromdev/peppers/net9-remap
Sep 11, 2025

Conversation

@jonathanpeppers
Copy link
Member

@jonathanpeppersjonathanpeppers commentedSep 9, 2025
edited
Loading

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) returnsnull 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 totrue for .NET 9+.

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

  • Add a test entry inRemaps.xml to remapcom.microsoft.intune.mam.client.view.MAMLayoutInflater to a test Java classnet.dot.android.test.MyLayoutInflater that extendsandroid.view.LayoutInflater.

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

After this is merged, I'll need to manually port this to main for .NET 10. Various files have moved around there; we can useRuntimeFeature.cs, etc.

… hatchContext:https://github.com/jonathanpeppers/IntuneReproNet9Context:35f41dcContext: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 thepackage:    <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 `Remaps.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`.After this is merged, I'll need to manually port this to main for .NET10. Various files have moved around there; we can use `RuntimeFeature.cs`, etc.
Comment on lines +13 to +17
<RuntimeHostConfigurationOptionInclude="Microsoft.Android.Runtime.RuntimeFeature.IsAssignableFromCheck"
Condition="'$(_AndroidIsAssignableFromCheck)' != ''"
Value="$(_AndroidIsAssignableFromCheck)"
Trim="true"
/>
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This needs to set even in Debug mode.

Comment on lines 47 to +48
<_AndroidRemapMembersInclude="Remaps.xml" />
<_AndroidRemapMembersInclude="IsAssignableFromRemaps.xml"Condition=" '$(_AndroidIsAssignableFromCheck)' == 'false'" />
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

IsAssignableFromRemaps.xml is in its own file, because we have a couple tests that need to use thereal Android LayoutInflater.

We run only theIntune category under-p:_AndroidIsAssignableFromCheck=false.

@jonathanpeppers
Copy link
MemberAuthor

New test passes, things look good:
image

The log messages say:

09-10 16:19:41.218  8179  8200 I DOTNET  : LayoutInflaterTest: TypeManager.IsAssignableFromCheck=False09-10 16:19:41.228  8179  8200 I monodroid-assembly: typemap: unable to find mapping to a managed type from Java type 'com/android/internal/policy/PhoneLayoutInflater' (hash 0x30a62d52bedc334d)...09-10 16:19:41.234  8179  8200 D monodroid-assembly: typemap: java type 'android/view/LayoutInflater' corresponds to managed token id 33554672 (0x20000f0)...09-10 16:19:41.235  8179  8200 D monodroid-assembly: typemap: type with token 33554679 (0x20000f7) in module {C848E954-4790-4169-B1F4-1EB5C125D804} (Mono.Android) corresponds to Java type 'android/view/LayoutInflater'...09-10 16:19:41.300  8179  8200 D monodroid-assembly: Handle 0x11 is of type 'com/android/internal/policy/PhoneLayoutInflater' which is not assignable to 'net/dot/android/test/MyLayoutInflater'...09-10 16:19:41.710  8179  8200 I NUnit   : Passed

@jonathanpeppersjonathanpeppers marked this pull request as ready for reviewSeptember 10, 2025 16:49
@jonathanpeppers
Copy link
MemberAuthor

This looks green, there are just a couple networking-related failures we can ignore:

System.Net.Http.HttpRequestException : net_http_message_not_success_statuscode_reason, 503, Service Temporarily Unavailable

@jonathanpeppersjonathanpeppers merged commitf395493 intorelease/9.0.1xxSep 11, 2025
55 of 57 checks passed
@jonathanpeppersjonathanpeppers deleted the dev/peppers/net9-remap branchSeptember 11, 2025 14:09
jonathanpeppers added a commit that referenced this pull requestSep 11, 2025
Forward port of:#10473Context:https://github.com/jonathanpeppers/IntuneReproNet9Context:35f41dcContext: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 thepackage:    <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.
grendello pushed a commit that referenced this pull requestSep 15, 2025
…tch (#10475)Forward port of:#10473Context:https://github.com/jonathanpeppers/IntuneReproNet9Context:35f41dcContext: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.
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 12, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@simonrozsivalsimonrozsivalsimonrozsival approved these changes

@grendellogrendelloAwaiting requested review from grendellogrendello is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@jonathanpeppers@simonrozsival

[8]ページ先頭

©2009-2025 Movatter.jp