-
Notifications
You must be signed in to change notification settings - Fork 562
[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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… hatch 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 `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 .NET 10. Various files have moved around there; we can use `RuntimeFeature.cs`, etc.
<RuntimeHostConfigurationOption Include="Microsoft.Android.Runtime.RuntimeFeature.IsAssignableFromCheck" | ||
Condition="'$(_AndroidIsAssignableFromCheck)' != ''" | ||
Value="$(_AndroidIsAssignableFromCheck)" | ||
Trim="true" | ||
/> |
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.
This needs to set even in Debug mode.
<_AndroidRemapMembers Include="Remaps.xml" /> | ||
<_AndroidRemapMembers Include="IsAssignableFromRemaps.xml" Condition=" '$(_AndroidIsAssignableFromCheck)' == 'false' " /> |
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.
IsAssignableFromRemaps.xml
is in its own file, because we have a couple tests that need to use the real Android LayoutInflater.
We run only the Intune
category under -p:_AndroidIsAssignableFromCheck=false
.
This looks green, there are just a couple networking-related failures we can ignore:
|
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.
…tch (#10475) 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.
Context: https://github.com/jonathanpeppers/IntuneReproNet9
Context: 35f41dc
Context: 9a27140
.NET 9 introduced a Java "instanceof" check for multiple reasons:
The problem with this check, is that it fails in combination with the package:
LayoutInflater.From (Context)
returnsnull
due to:To solve this:
Introduce
-p:_AndroidIsAssignableFromCheck=false
to disable the check, defaulting totrue
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 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 use
RuntimeFeature.cs
, etc.