-
I have a class as such in a Unity Package, with an namespace Analytics.AppsFlyerPlatform
{
public class CallFilter
{
HashSet<ulong> set = new HashSet<ulong>();
}
} I tried many variation of
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
By the way thanks for the awesome package, made it easy to use newtonsoft for unity 👍 |
Beta Was this translation helpful? Give feedback.
-
Hi! Thanks for reporting, I'm eager to help :) The exception is due to failing to deserialize your type, as you notice. However the issue does not lie in YOUR codebase, and that's why your link.xml attempts failed. To be specific, the errors says it fails to construct the following type from the Newtonsoft.Json.Utilities.CollectionWrapper<ulong> I strongly recommend solving this via AotHelper, however it can also be solved via link.xml. To solve via AotHelper you may add the following to a method inside a MonoBehaviour/ScriptableObject (any will do, not only one you're using): AotHelper.EnsureList<ulong>(); You can find full specs of the AotHelper in the wiki page here: https://github.com/jilleJr/Newtonsoft.Json-for-Unity/wiki/Reference-Newtonsoft.Json.Utilities.AotHelper#aothelperensurelist |
Beta Was this translation helpful? Give feedback.
-
Would you be so kind to show me how the link.xml would look like? I cant seem to figure that out. |
Beta Was this translation helpful? Give feedback.
-
Yes. However generics are not fully compatible with However for completeness sake, here's how to target the CollectionWrapper: (Note that you cannot target the specific generic type for preservation, but instead preserve ALL compiled generics for the CollectionWrapper) <linker>
<assembly fullname="Newtonsoft.Json">
<type fullname="Newtonsoft.Json.Utilities.CollectionWrapper`1" preserve="all" />
</assembly>
</linker> I've written a small reference document for link.xml containing some of the common use cases. Have a look at the example in this page: https://github.com/jilleJr/Newtonsoft.Json-for-Unity/wiki/Reference-link.xml#the-method-element |
Beta Was this translation helpful? Give feedback.
-
Ah gotcha. So i was preserving the wrong stuff. Thanks once again 👍 |
Beta Was this translation helpful? Give feedback.
Hi! Thanks for reporting, I'm eager to help :)
The exception is due to failing to deserialize your type, as you notice. However the issue does not lie in YOUR codebase, and that's why your link.xml attempts failed. To be specific, the errors says it fails to construct the following type from the
Newtonsoft.Json
assembly:I strongly recommend solving this via AotHelper, however it can also be solved via link.xml. To solve via AotHelper you may add the following to a method inside a MonoBehaviour/ScriptableObject (any will do, not only one you're using):
You can find full specs of the AotHelper in the wiki pag…