Bug 4999 - 4.1.2 REGRESSION: AsyncTask with string parameter dies with InvalidCastException
Summary: 4.1.2 REGRESSION: AsyncTask with string parameter dies with InvalidCastException
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.1.x
Hardware: PC Mac OS
: --- critical
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-05-10 10:04 UTC by Jonathan Pryor
Modified: 2012-05-10 14:37 UTC (History)
1 user (show)

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


Attachments
AsyncTest.7z (225.52 KB, application/x-7z-compressed)
2012-05-10 10:04 UTC, Jonathan Pryor
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 FIXED

Description Jonathan Pryor 2012-05-10 10:04:50 UTC
Created attachment 1848 [details]
AsyncTest.7z

AsyncTask with string parameter dies with InvalidCastException

To reproduce:

1. Extract, install, run the attached project.

Expected results:

No error.

Actual results:


> Unhandled Exception: System.InvalidCastException: Value is not a convertible object: Java.Lang.String to System.String
>   at System.Convert.ToType (System.Object value, System.Type conversionType, IFormatProvider provider, Boolean try_target_to_type) [0x00000] in <filename unknown>:0 
>   at System.Convert.ChangeType (System.Object value, System.Type conversionType) [0x00000] in <filename unknown>:0 
>   at Java.Interop.JavaConvert.FromJavaObject[String] (IJavaObject value) [0x00000] in <filename unknown>:0 
>   at Android.OS.AsyncTask`3[System.String,System.Int32,AsyncTest.RandomUDT].DoInBackground (Java.Lang.Object[] native_parms) [0x00000] in <filename unknown>:0 
>   at Android.OS.AsyncTask.n_DoInBackground_arrayLjava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native__params) [0x00000] in <filename unknown>:0 
>   at (wrapper dynamic-method) object:2c1ed6b4-1136-4310-b7ea-9b6d24a3642a (intptr,intptr,intptr)
>
Comment 1 Jonathan Pryor 2012-05-10 14:37:26 UTC
Fixed in master/8419c600 and 4.2-series/087579a5.