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

TypeDescriptor.Getconverter stops working when linker behavior is set to "Link all assemblies"

$
0
0

Hi all

I wonder if anyone else ran into this problem.

I'm using TypeConverters and I noticed when I set the linker to Link all assemblies, TypeDescriptor.GetConverter fails to return the typeconverter I specified with an attribute.

Here is the code i tried

[TypeConverter(typeof(TestEnumTypeConverter))]
public enum TestEnum
{
    One,Two
}


public class TestEnumTypeConverter:TypeConverter
{
    public override object ConvertTo (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
    {
        return "hello";
    }
}

Then in your ViewDidLoad, call the following

var tc = TypeDescriptor.GetConverter(typeof(TestEnum));
Console.WriteLine(tc.GetType().ToString());

With the default linker option, I get the correct TypeConverter. With the Link all option, I always get System.ComponentModel.EnumConverter

I'll see if I can use the default linker option as a workaround for now. Is this a known issue?

I'm using Xamarin iOS v6.2.7.1

  • edit: Adding [Preserve] to the TestEnumTypeConverter didn't help either

Viewing all articles
Browse latest Browse all 204402

Trending Articles



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