-
Notifications
You must be signed in to change notification settings - Fork 546
Test https://github.com/xamarin/java.interop/pull/1199 #8751
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
Closed
Conversation
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
These test failures are disturbing;
I'm reminded of the typemap snafu in #8478 (comment), which doesn't make immediate sense to me. |
Yes, the test failures are somehow caused by: dotnet/java-interop@56b7eeb But this fixed the build errors now. |
This reverts commit 1bf3e16.
The Windows build failure is weird:
|
jonpryor
pushed a commit
to dotnet/java-interop
that referenced
this pull request
Feb 24, 2024
Context: dotnet/android#8751 Context: 56b7eeb Context: 67c079c dotnet/android#8751 attempts to figure out how Java.Interop broke xamarin-android. That investigation eventually resulted in 67c079c, which allowed xamarin-android to *build* again, and uncovered a unit test failure. [`JnienvTest.NewObjectArrayWithNonJavaTypeAndEmptyArray()`][0]: [Test] public void NewObjectArrayWithNonJavaTypeAndEmptyArray () { //empty array gives the right type var array = JNIEnv.NewObjectArray<Type> (new Type [0]); … } started failing: Java.Lang.ClassNotFoundException : crc64d04135c992393d83.Type ----> Java.Lang.ClassNotFoundException : Didn't find class "crc64d04135c992393d83.Type" on path: DexPathList[[zip file "/data/app/Mono.Android.NET_Tests-VrfrXDHT2r32zDG95kFOiw==/base.apk", zip file "/data/app/Mono.Android.NET_Tests-VrfrXDHT2r32zDG95kFOiw==/split_config.x86_64.apk", zip file "/data/app/Mono.Android.NET_Tests-VrfrXDHT2r32zDG95kFOiw==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/Mono.Android.NET_Tests-VrfrXDHT2r32zDG95kFOiw==/lib/x86_64, /data/app/Mono.Android.NET_Tests-VrfrXDHT2r32zDG95kFOiw==/base.apk!/lib/x86_64, /data/app/Mono.Android.NET_Tests-VrfrXDHT2r32zDG95kFOiw==/split_config.x86_64.apk!/lib/x86_64, /data/app/Mono.Android.NET_Tests-VrfrXDHT2r32zDG95kFOiw==/split_config.xxhdpi.apk!/lib/x86_64, /system/lib64, /system/product/lib64]] It turns out, this type is completely wrong? It should be looking for `java/lang/Object` instead? In 56b7eeb, we lost an important detail from the expression: // 56b7eeb^ if (!type.GetInterfaces ().Any (t => t.FullName == "Android.Runtime.IJavaObject")) … // 56b7eeb equivalent: if (type.GetInterfaces ().Any (t => t.FullName == "Java.Interop.IJavaPeerable")) … We are missing the `!` !!! I was able to reproduce this behavior in a test: [Test] [TestCase (typeof (System.Type), "java/lang/Object")] public void ToJniName (Type type, string expected) { string actual = JavaNativeTypeManager.ToJniName (type); Assert.AreEqual (expected, actual); } Where `ToJniName()` was returning `crc64d04135c992393d83/Type` instead of `java/lang/Object`! After fixing the problem, the test passes. [0]: https://github.com/xamarin/xamarin-android/blob/0665f449948c43675ec8706a5a2807b5d3f599f7/tests/Mono.Android-Tests/Java.Interop/JnienvTest.cs#L178-L186
This reverts commit bb40a5e.
jonpryor
pushed a commit
to dotnet/java-interop
that referenced
this pull request
Feb 27, 2024
…1199) Context: dotnet/android#8751 Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9137456&view=logs&j=96fd57f5-f69e-53c7-3d47-f67e6cf9b93e&s=1afc3bfe-122c-538b-e9ad-2a86c2efcfef&t=38f83f46-bc21-5edd-1614-e44f20babf10&l=29658 Context: 67c079c Context: 56b7eeb dotnet/android#8751 has a random build failure: "Xamarin.Android.sln" (default target) (1:2) -> "src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj" (default target) (28:9) -> (CoreCompile target) -> src/Xamarin.Android.Build.Tasks/Utilities/MamJsonParser.cs(92,43): error CS0122: 'NotNullWhenAttribute' is inaccessible due to its protection level [src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj] src/Xamarin.Android.Build.Tasks/Utilities/MamJsonParser.cs(92,81): error CS0122: 'NotNullWhenAttribute' is inaccessible due to its protection level [src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj] src/Xamarin.Android.Build.Tasks/Utilities/MavenExtensions.cs(26,32): error CS0122: 'NotNullWhenAttribute' is inaccessible due to its protection level [src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj] It happens some percentage of the time… Similar to 67c079c, the cause is that commit 56b7eeb updated `Java.Interop.Tools.JavaCallableWrappers.csproj` to multitarget both netstandard2.0 and net8.0, and on some builds the `Java.Interop.Tools.JavaCallableWrappers.dll` used by `Xamarin.Android.Build.Tasks.csproj` is the net8.0 build, *not* the netstandard2.0 build. To fix this: * Don't build `Java.Interop.Tools.JavaCallableWrappers.csproj` for `net8.0` anymore; remove net8.0 from `$(TargetFrameworks)`. * Introduce a new `Java.Interop.Tools.TypeNameMappings.csproj` project which builds the source code within `Java.Interop.Tools.JavaCallableWrappers.csproj` for net8.0. The resulting assembly is not shipped or used. It can check trimmer warnings, though. This partially reverts 67c079c and 56b7eeb.
Closing in favor of #8766 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.