Bug 60383 - NetworkInterface.OperationalStatus causes JNI crash: jclass has wrong type: java.lang.String in call to CallStaticObjectMethod, or, JNI ERROR (app bug): attempt to use stale Local 0x71 (should be 0x75)
Summary: NetworkInterface.OperationalStatus causes JNI crash: jclass has wrong type: j...
Status: RESOLVED DUPLICATE of bug 59045
Alias: None
Product: Android
Classification: Xamarin
Component: Android+BCL Integration ()
Version: 8.0 (15.4)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Habersack
URL:
Depends on:
Blocks:
 
Reported: 2017-10-26 01:17 UTC by Joshua
Modified: 2017-10-30 02:23 UTC (History)
8 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test App source code and two log files corresponding to the two different test cases (50.26 KB, application/zip)
2017-10-26 01:17 UTC, Joshua
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 59045

Description Joshua 2017-10-26 01:17:34 UTC
Created attachment 25462 [details]
Test App source code and two log files corresponding to the two different test cases

+++ This bug was initially created as a clone of Bug #59045 +++

When running Xamarin.Form's code, Android app crashes.

This bug is related to Bug #59045 and #52733, and most likely a duplicate of them, i.e. sharing the same root cause. Bug #59045 has been resolved on Sept 12, 2017. However, with Visual Studio v15.4.1, Xamarin 4.7.10.22, and Xamarin.Android SDK - 8.0.0.33, all of which were released on Oct 20, 2017, Bug #59045 and #52733 can still be reproduced.

I've reduces the code to the bare minimum for reproducing the crash. The test App is a bit different from Bug #59045 and #52733. The key point is, by toggling a line of code, the test App can produce the same crash as that of either Bug #59045 or #52733.  

Build Environment
- Visual Studio 2017 v15.4.1, MS .NET Framework v4.6.01586, on Windows 10
- Xamarin v4.7.10.22
- Xamarin.Android SDK v8.0.0.33

To reproduce the crash, build and run the attached test App. It looks like that the bug was introduced since Mono Android v7, as shown by the following test results. 

The crash has been reproduced with the following Android platforms.

Pixel XL, Android 8.0.0
Pixel C, Android 8.0.0
Nexus 9, Android 7.1.1
Emulator Android_Accelerated_Nougat, Google APIs Intel Atom (x86_64), Android 7.1.1

The crash cannot be reproduced with the following Android platforms.

Emulator VisualStudio_android-23_x86_64_phone, Intel Atom (x86_64), Android 6.0
Samsung Galaxy Tab A (2016), SM-T280, Android 5.1.1

Additional Notes:

The following line of code in the test App affects the message of the crash. It also affects when the crash occurs. However, in both cases, the crash is triggered by the same line of code. The details are noted in the source code file "MainActivity.cs"

Line 58 in "MainActivity.cs":

await Task.Yield();

With this line of code, the message of the crash is the following, and the crash occurs after clicking the button once.

JNI DETECTED ERROR IN APPLICATION: jclass has wrong type: java.lang.String in call to CallStaticObjectMethod

Without this line code, the message of the crash is the following, and the crash occurs after clicking the button the second time.

JNI ERROR (app bug): attempt to use stale Local 0x71 (should be 0x75)

Attached a zip file that contains the test App source code and two log files corresponding to the two different test cases with Pixel C.
Comment 1 Jon Douglas [MSFT] 2017-10-26 01:43:39 UTC
Hi Joshua,

I was able to reproduce on the Stable channel.

It seems like this issue is however fixed in our Preview channel. Can you please try downloading the Visual Studio Preview?

https://developer.xamarin.com/releases/android/xamarin.android_8/xamarin.android_8.1/#Installing

If you can confirm on your end this is fixed for you, I will mark this as a duplicate of 59045

Thank you!
Comment 2 Joshua 2017-10-26 09:13:46 UTC
Hi Jon,

Thank you for the really prompt response!

I build and tested the attached test App with VS 2017 15.5 Preview 2, with Pixel XL, Android 8.0.0.

The crash cases reported with both Xamarin Bug #59045 and #52733 have been fixed.

I will test more Android platforms and let you know the results.

Thank you!
Comment 3 Joshua 2017-10-26 21:42:50 UTC
Hi Jon,

I built and run the attached test App with VS 2017 15.5 Preview 2, on all Android platforms that I tested before. Not any crash occurred, either the crash reported with #59045, or the one with #52733. BTW, for testing $59045, I made a small code change in the attached test App as detailed in the "Description Section" above.

It looks like to me that this bug report can definitely be marked as a duplicate of both #59045 and #52733, and #52733 can be marked as resolved, too.
 
We are looking forward to the next stable release of VS 2017!
Comment 4 Joshua 2017-10-26 22:47:22 UTC
Hi Jon,

I am a new user of bugzilla. In case you are not notified with the comments I added, I am doing a "reply" to let you know that I have added two comments regarding my concluded tests.

Thanks,

Joshua
Comment 5 Jon Douglas [MSFT] 2017-10-30 02:23:46 UTC
Marked this bug as a duplicate as per comment https://bugzilla.xamarin.com/show_bug.cgi?id=60383#c3

Thank you for the report!

*** This bug has been marked as a duplicate of bug 59045 ***