Bug 9959 - Java.Lang.ArrayStoreException when passing parameters to AsyncTask.Execute
Summary: Java.Lang.ArrayStoreException when passing parameters to AsyncTask.Execute
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.4.x
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2013-01-31 17:18 UTC by Stephan Desmoulin
Modified: 2017-06-28 14:22 UTC (History)
6 users (show)

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

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:

Description Stephan Desmoulin 2013-01-31 17:18:20 UTC
I have encountered an exception today in Android 4.2.1 Jellybean, Samsung Galaxy S3, Monodroid, Windows 8 x64, Visual Studio 2012 Ultimate SP1.

The exception occurs when passing an array of Object variables to AsyncTask.Execute(). I've included a stack trace below for reference. I do not believe that Windows or Visual Studio have any bearing, as the same project deployed to an Android 2.3.5 device (Motorola Electrify) does not exhibit the same issue.

I would be happy to perform any additional troubleshooting and debugging to assist in the resolution of this issue.


Stephan Desmoulin

Stack Trace:
Java.Lang.ArrayStoreException: mono.android.runtime.JavaObject cannot be stored in an array of type java.lang.Boolean[]

 	0x1 in System.Diagnostics.Debugger.Mono_UnhandledException	C#
 	0x26 in object.8c267011-348f-4fa7-abaa-6c620a187ec5	C#
 	0x24 in Android.Runtime.JNIEnv.SetObjectArrayElement at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1134	C#
 	0x12 in Android.Runtime.JNIEnv.NewObjectArray<object>.AnonymousMethod__92 at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:1106	C#
 	0x4C in Java.Interop.JavaConvert.WithLocalJniHandle at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Java.Interop/JavaConvert.cs:295	C#
>	0xE9 in Android.Runtime.JNIEnv.NewObjectArray at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:1105	C#
 	0x2E in Android.OS.AsyncTask<object,int,object>.Execute at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Android.OS/AsyncTask.cs:69	C#
 	0x43 in BWEN.Android.Common.BasicBackgrounderManager.RunTask at \\hv-desmoulin\hvfs\Profiles\aifdsc\Documents\Visual Studio 2012\Projects\FAR\Android\Code\Common\Backgrounder.cs:272	C#
Comment 1 Stephan Desmoulin 2013-01-31 17:54:10 UTC
Additional notes:

I have not been able to replicate if the parameters passed to AsyncTask.Execute are all string values. It appears that a mixture of data types being passed causes this exception.
Comment 2 Miguel de Icaza [MSFT] 2013-05-22 15:52:02 UTC
Stephan, to help us accelerate this, do you have a code snippet that shows what exactly you were doing that caused this?
Comment 3 Jonathan Pryor 2014-01-10 21:58:12 UTC
Please provide a repro, or try a more recent version. (There have been a number of marshaling fixes since 4.4.x.)
Comment 4 Chris Hardy [MSFT] 2017-06-28 14:22:49 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!