-
Notifications
You must be signed in to change notification settings - Fork 131
JsonConverter type of: UnixDateTimeConverter throws exception #8
Comments
Assuming this works on other platforms such as in the editor, and since you're targeting iOS specifically which has stricter stripping rules than other AOT platforms, I'm assuming this is due to bytecode stripping removing the Perhaps just referring to the type is not good enough. To fix, add this <linker>
<assembly fullname="Newtonsoft.Json">
<type fullname="Newtonsoft.Json.Converters.UnixDateTimeConverter" preserve="all"/>
</assembly>
</linker> |
This worked. Thanks for the workaround. |
Cool! Keeping this issue open as a future note to myself to add documentation about adding link.xml files. |
The call stack above for |
Yes this is a very common and known issue. What I may do instead is force the linker to include all converters by default. Instead of having to specify it explicitly. Problem with that is then there wont be a way to strip them anymore. A price we all can pay I presume. Talking few small classes either way. |
C# Destination types
Source JSON
Expected behavior
The Json.NET package should deserialise the unix timestamp in the json data to System.DateTime instead of as an integer/string/other. This value deserialises correctly in Editor.
Actual behavior
When running an iOS build on iPhone this code throws exceptions:
Steps to reproduce
[JsonConverter(typeof(UnixDateTimeConverter))]
"startdate":1568067791
Newtonsoft.Json.JsonConvert.DeserializeObject<T>
The text was updated successfully, but these errors were encountered: