Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

EmployeeDirectory.Android: Cannot cast from source to destination type #20

Open
truseed opened this issue Feb 19, 2014 · 2 comments
Open

Comments

@truseed
Copy link

truseed commented Feb 19, 2014

I have just pulled the EmployeeDirectory app, and when I run the Android app, after logging in, an exception is thrown in the PeopleGroupsAdapter.cs (A System.InvalidCastException was thrown. Cannot cast from source type to destination type.)

Someone else has had this problem see here

http://forums.xamarin.com/discussion/9492/what-is-wrong-with-this-code

and here

http://stackoverflow.com/questions/21587387/cannot-cast-from-source-type-to-destination-type

@jmillerdev
Copy link

I recently revisited this, and running this on at least API 14 on an Intel emulator it worked (I didn't try anything older). I don't know why that makes a difference. I did get this occasionally on API 18 (I think) using an ARM based emulator.

Update: Tested on API 16 using Intel Emulator, and it works fine out of the box.

@therealjohn
Copy link

This crashes on API 19.

Workaround:

var array = sections.Select(s => new Java.Lang.String(s)).ToArray();
return (Java.Lang.Object [])array;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants