This has been filed as: http://bugzilla.xamarin.com/show_bug.cgi?id=2147
Thanks, - Jon On Nov 18, 2011, at 6:34 AM, uh wrote: > Hello, > > I receive a InvalidCastException, that I cannot understand in the following > codes: > > try > { > Android.Runtime.JavaList<Dictionary<String, object>> jl = new > Android.Runtime.JavaList<Dictionary<String, object>>(); > Dictionary<String, object> v = new Dictionary<String, object>(); > v.Add("szLongName", "Bla.pdf"); > jl.Add(v); // Exception > } > catch(Exception ex) > { > } > > Exception: > > Cannot cast from source type to destination type. > at > Android.Runtime.JavaTypeConverter`1+JavaDictionaryConverter`1[System.Collections.Generic.Dictionary`2[System.String,System.Object],System.Collections.Generic.Dictionary`2[System.String,System.Object]].ToNative > (System.Collections.Generic.Dictionary`2 val) [0x0001c] in > /Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaTypeConverter.cs:298 > > at > Android.Runtime.JavaList`1[System.Collections.Generic.Dictionary`2[System.String,System.Object]].Add > (System.Collections.Generic.Dictionary`2 item) [0x00000] in > /Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaList.cs:250 > > at HelloM4A.Activity3.OnCreate (Android.OS.Bundle bundle) [0x00023] in > /Users/uh/Projects/HelloM4A/HelloM4A/Activity3.cs:37 > > > try > { > Android.Runtime.JavaList jl = new Android.Runtime.JavaList(); > Dictionary<String, object> v = new Dictionary<String, object>(); > v.Add("szLongName", "Bla.pdf"); > jl.Add(v); > Dictionary<String, object> vo = (Dictionary<String, object>)jl[0]; // > Exception > } > catch(Exception ex) > { > } > > Exception: > > Cannot cast from source type to destination type. > at > Android.Runtime.JavaTypeConverter`1+JavaDictionaryConverter`1[System.Collections.Generic.Dictionary`2[System.String,System.Object],System.Collections.Generic.Dictionary`2[System.String,System.Object]].ToNative > (System.Collections.Generic.Dictionary`2 val) [0x0001c] in > /Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaTypeConverter.cs:298 > > at > Android.Runtime.JavaList`1[System.Collections.Generic.Dictionary`2[System.String,System.Object]].Add > (System.Collections.Generic.Dictionary`2 item) [0x00000] in > /Users/jon/Development/xamarin/monodroid/Mono.Android/src/Runtime/JavaList.cs:250 > > at HelloM4A.Activity3.OnCreate (Android.OS.Bundle bundle) [0x00023] in > /Users/uh/Projects/HelloM4A/HelloM4A/Activity3.cs:37 > > > I cannot understand, what the problem is. Source and Destination types are > exactly identical. > > Regards, > Uwe Honermann > windream GmbH > > > -- > View this message in context: > http://mono-for-android.1047100.n5.nabble.com/Strange-InvalidCastException-tp5004015p5004015.html > Sent from the Mono for Android mailing list archive at Nabble.com. > _______________________________________________ > Monodroid mailing list > Monodroid@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid