Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Type cast error in Xamarin 6.4.3 on device only

$
0
0

I'm getting a type cast error on Xamarin 6.4.3 on the device only. We've observed on iPhone 5 and iPhone 3GS. The error does not occur in the IOS 6.1 Simulator.

The error appears to be similar to this issue: https://bugzilla.xamarin.com/show_bug.cgi?id=13518

I can reproduce with the class below.


using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;

namespace XamarinBugExample
{
    [DataContract(Namespace="XamarinBugExample")]
    public enum MyEnum : short
    {
        [EnumMember]
        Foo = 0,
        [EnumMember]
        Bar = 1,
        [EnumMember]
        Baz = 2
    }

    [DataContract(Namespace="XamarinBugExample")]
    public class MyClass
    {
        public MyClass() { }

        [DataMember]
        List MyList { get; set; }
    }

    public class CrashExample
    {
        public CrashExample ()
        {

        }

        public void DoCrash()
        {
            System.Collections.IList lst = new List();
            object value = Enum.Parse (typeof(MyEnum), "1");
            lst.Add (value); // Exception here.  List.cs throws ArgumentException.
        }
    }
}



Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>