xml - Xamarin Android App will not deserialize Size and Point when Linking is None -
i have android app save report layout in xml format. each field has system.drawing.size size , system.drawing.point location.
the xml point
<location> <x>32</x> <y>40</y> </location> the xml size
<size> <width>600</width> <height>56</height> </size> the object contains properties same
private size _size = new size(50, 20); public size size { { return _size; } set { bool doevent = true; if (value.height == _size.height && value.width == _size.width) doevent = false; _size = value; if (doevent) onpropertychanged("size"); } } and
private system.drawing.point _location; public system.drawing.point location { { return _location; } set { _location = value; onpropertychanged("location"); } } i create serialzer follows
public static void newserializer() { type[] extratypes = new type[7]; extratypes[0] = typeof(mpsreportpage); extratypes[1] = typeof(mpsreportfield); extratypes[2] = typeof(mpstextfield); extratypes[3] = typeof(mpsimagefield); extratypes[4] = typeof(margins); extratypes[5] = typeof(size); extratypes[6] = typeof(system.drawing.point); try { reportserializer = new xmlserializer(typeof(mpsreportdocument), extratypes); } catch (exception ex) { console.writeline(ex.tostring()); } //reportserializer = new xmlserializer(typeof(mpsreportdocument)); } the point , size not there extratypes added them try resolve issue.
this deserializes fine if set linking none. if set linking sdk only, both field types deserialize 0, 0. other field types deserialize fine. in advance this.
https://github.com/jimwilcox3/xmlserializertest
is link visual studio solution shows problem.
in .csproj, add mono.android assembly androidlinkskip within propertygroup property release configuration (or debug if desired).
<androidlinkskip>mono.android</androidlinkskip> or add via ide:
you need review sweep step of monolinker determine exact element(s) being stripped create xml descriptor file prevents needed types being removed, disabling linking on entire mono.android assembly work , allow xml deserialization function properly.

Comments
Post a Comment