Bug 15297 - expected return type 'L' calling Landroid/text/SpannableString;.getSpanFlags
Summary: expected return type 'L' calling Landroid/text/SpannableString;.getSpanFlags
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 4.8.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2013-10-09 06:57 UTC by Luzanne
Modified: 2014-03-31 04:51 UTC (History)
2 users (show)

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


Attachments
Test case (16.11 KB, application/octet-stream)
2013-10-09 06:57 UTC, Luzanne
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:
VERIFIED FIXED

Description Luzanne 2013-10-09 06:57:16 UTC
Created attachment 5097 [details]
Test case

Systeminformation:
Windows 7 64b
VS 2012 (Professional) Version 11.0.60610.01 Update 3
Microsoft .NET Framework Version 4.5.50709
Xamarin.Android 4.8.02054 (dac24182)


The case:
When calling GetSpanFlags, the runtime crashes with a JNI error. This happens only when targeting Android 3.1 and higher. On target Android 2.2 it is working as expected.


How to reproduce:
1. Open the project in the attachment
2. Press F5. It crashes with the error below.
3. Change the csproj to use API lvl 8 at 'Compile using Android version:' and 'Target Android Version' in stead of API lvl 12.
4. Run the project again, the application does not crash.




10-09 12:28:15.782 D/dalvikvm(12188): Late-enabling CheckJNI
10-09 12:28:15.798 I/dalvikvm(12188): Turning on JNI app bug workarounds for target SDK version 12...
10-09 12:28:15.907 D/dalvikvm(12188): Trying to load lib /data/app-lib/SpannableString.SpannableString-2/libmonodroid.so 0x4202e8c8
10-09 12:28:15.915 D/dalvikvm(12188): Added shared lib /data/app-lib/SpannableString.SpannableString-2/libmonodroid.so 0x4202e8c8
10-09 12:28:16.025 W/MonoDroid-Debugger(12188): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8923,server=y,embedding=1
10-09 12:28:16.048 W/MonoDroid-Debugger(12188): Accepted stdout connection: 40
10-09 12:28:16.806 W/libc    (12188): WARNING: generic atexit() called from legacy shared library
10-09 12:28:17.415 W/monodroid-gc(12188): GREF GC Threshold: 46800
Loaded assembly: /data/data/SpannableString.SpannableString/files/.__override__/SpannableString.dll
Loaded assembly: Mono.Android.dll [External]
Loaded assembly: System.Core.dll [External]
Loaded assembly: MonoDroidConstructors [External]
10-09 12:28:20.501 W/dalvikvm(12188): JNI WARNING: expected return type 'L'
10-09 12:28:20.501 W/dalvikvm(12188):              calling Landroid/text/SpannableString;.getSpanFlags (Ljava/lang/Object;)I
10-09 12:28:20.509 W/dalvikvm(12188):              in Lspannablestring/Activity1;.n_onCreate:(Landroid/os/Bundle;)V (CallObjectMethodA)
10-09 12:28:20.509 I/dalvikvm(12188): "main" prio=5 tid=1 NATIVE
10-09 12:28:20.509 I/dalvikvm(12188):   | group="main" sCount=0 dsCount=0 obj=0x41787578 self=0x416691c0
10-09 12:28:20.509 I/dalvikvm(12188):   | sysTid=12188 nice=0 sched=0/0 cgrp=apps handle=1074163708
10-09 12:28:20.509 I/dalvikvm(12188):   | state=R schedstat=( 0 0 0 ) utm=102 stm=24 core=0
10-09 12:28:20.525 I/dalvikvm(12188):   #00  pc 000012fe  /system/lib/libcorkscrew.so (unwind_backtrace_thread+29)
10-09 12:28:20.525 I/dalvikvm(12188):   #01  pc 0005fff6  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+33)
10-09 12:28:20.525 I/dalvikvm(12188):   #02  pc 00054080  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+395)
In mgmain JNI_OnLoad
10-09 12:28:20.525 I/dalvikvm(12188):   #03  pc 000540ee  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
10-09 12:28:20.525 I/dalvikvm(12188):   #04  pc 000386a8  /system/lib/libdvm.so
10-09 12:28:20.525 I/dalvikvm(12188):   #05  pc 0004092c  /system/lib/libdvm.so
10-09 12:28:20.525 I/dalvikvm(12188):   at spannablestring.Activity1.n_onCreate(Native Method)
10-09 12:28:20.525 I/dalvikvm(12188):   at spannablestring.Activity1.onCreate(Activity1.java:28)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.app.Activity.performCreate(Activity.java:5133)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.os.Handler.dispatchMessage(Handler.java:99)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.os.Looper.loop(Looper.java:137)
10-09 12:28:20.525 I/dalvikvm(12188):   at android.app.ActivityThread.main(ActivityThread.java:5103)
10-09 12:28:20.525 I/dalvikvm(12188):   at java.lang.reflect.Method.invokeNative(Native Method)
10-09 12:28:20.525 I/dalvikvm(12188):   at java.lang.reflect.Method.invoke(Method.java:525)
10-09 12:28:20.525 I/dalvikvm(12188):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-09 12:28:20.525 I/dalvikvm(12188):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-09 12:28:20.525 I/dalvikvm(12188):   at dalvik.system.NativeStart.main(Native Method)
10-09 12:28:20.525 I/dalvikvm(12188): 
10-09 12:28:20.525 E/dalvikvm(12188): VM aborting
10-09 12:28:20.525 E/mono-rt (12188): Stacktrace:
10-09 12:28:20.525 E/mono-rt (12188): 
10-09 12:28:20.525 E/mono-rt (12188):   at <unknown> <0xffffffff>
10-09 12:28:20.532 E/mono-rt (12188):   at (wrapper managed-to-native) object.wrapper_native_0x409498e1 (intptr,intptr,intptr,Android.Runtime.JValue[]) <IL 0x00127, 0xffffffff>
10-09 12:28:20.532 E/mono-rt (12188):   at (wrapper delegate-invoke) <Module>.invoke_intptr__this___intptr_intptr_intptr_JValue[] (intptr,intptr,intptr,Android.Runtime.JValue[]) <IL 0x00063, 0xffffffff>
10-09 12:28:20.532 E/mono-rt (12188):   at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.2-branch/dac24182/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:141
10-09 12:28:20.532 E/mono-rt (12188):   at Android.Text.SpannableString.GetSpanFlags (Java.Lang.Object) [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.2-branch/dac24182/source/monodroid/src/Mono.Android/platforms/android-12/src/generated/Android.Text.SpannableString.cs:130
10-09 12:28:20.532 E/mono-rt (12188):   at SpannableString.Activity1.OnCreate (Android.OS.Bundle) [0x00063] in \\psf\home\Documents\Visual Studio 2012\Projects\SpannableString\SpannableString\Activity1.cs:23
10-09 12:28:20.532 E/mono-rt (12188):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.2-branch/dac24182/source/monodroid/src/Mono.Android/platforms/android-12/src/generated/Android.App.Activity.cs:1919
10-09 12:28:20.532 E/mono-rt (12188):   at (wrapper dynamic-method) object.08570254-2e86-43f7-8a1c-60552787282f (intptr,intptr,intptr) <IL 0x00017, 0x00043>
10-09 12:28:20.532 E/mono-rt (12188):   at (wrapper native-to-managed) object.08570254-2e86-43f7-8a1c-60552787282f (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>
10-09 12:28:20.532 E/mono-rt (12188): 
10-09 12:28:20.532 E/mono-rt (12188): =================================================================
10-09 12:28:20.532 E/mono-rt (12188): Got a SIGSEGV while executing native code. This usually indicates
10-09 12:28:20.532 E/mono-rt (12188): a fatal error in the mono runtime or one of the native libraries 
10-09 12:28:20.532 E/mono-rt (12188): used by your application.
10-09 12:28:20.532 E/mono-rt (12188): =================================================================
10-09 12:28:20.532 E/mono-rt (12188): 
The program 'Mono' has exited with code 0 (0x0).
Comment 1 Jonathan Pryor 2013-10-10 11:52:33 UTC
Fixed in monodroid/74753e9c.
Comment 2 Nischal 2014-03-31 04:51:08 UTC
Checked as per steps mentioned in Description, now application build and deploy successfully.

Environment Info:
Xamarin Studio
Version 4.2.4 (build 266) 
Build Information
Git revision: 57fa6b7639703775ae1d5c46536e42ab424cb177
Xamarin addins: eee141c29724a19529e77b8e743086d95b29f5ba
Xamarin.Android 4.13.0-04 (Win)