System.Xml.Serialization in UWP with IL2CPP

Hey,

I’m trying to port an existing application to UWP with the IL2CPP backend. It works fine mostly, however we make use of the System.Xml.Serialization and this seems to crash with this setup. I found a related issue here:
Unity Issue Tracker

Are there known alternatives or workarounds for this? I basically just need to de-/serialize XML files. I tried ZeroFormatter (see here), but can’t yet find a way to give it the string/bytes from a human readable XML file as input.

Thanks and best regards

You should not need a work around for this issue, at least not in Unity 2018.1 or later. I incorrectly marked that bug report as Won’t Fix - sorry about that.

The problem here is managed code in System.Xml.dll that does not place nicely with an AOT compiler (like IL2CPP).

We’ve corrected this issue in 2018.1 and 2018.2. In those versions of Unity, you will need to use the .Net Standard 2.0 Api Compatibility Level to get the AOT-friendly version of System.Xml.dll. In Unity 2018.3 we will also have an AOT-friendly version of System.Xml.dll for the .NET 4.x Api Compatibility Level.

@JoshPeterson
Will it be for the official release because I tried the beta and the problem still seems to persis?
.

Aah, thanks, that’s very interesting to hear. I actually was using Unity 2017.3 and just upgraded to 2018.1, but using the .NET 4.x api compability level. Will try to go back to 2.0 then and test, if it works with that :slight_smile:
Is the fix for .NET 4.x a save thing to expect for 2018.3?

So currently, there’s no reason to use .NET 4.x is you are doing anything related to serialization?
Changes aren’t going to be back-ported to 2013.2, right? Only 2013.3 will get a fix?