Swifter.Json icon indicating copy to clipboard operation
Swifter.Json copied to clipboard

Issues with Unity

Open MagicJinn opened this issue 1 year ago • 0 comments

Hello there! I love Swifter.Json—it consistently outperforms all other deserializers (JsonFx: 2000ms, Newtonsoft: 1000ms, Swifter.Json: 300ms). However, I’m encountering issues when trying to use it in Unity. I couldn’t find any documentation about using it in Unity on this repo, though I noticed some people mentioning using it in Unity in the issues section, so it seems like a valid use case.

Here’s the problem:
When I try to import the .NET 3.5 DLL into Unity, I get the following error:

error CS0009: Metadata file `\Assets/Plugins/Swifter.Json.dll' does not contain valid metadata`

I encounter the same error for Swifter.Core.

Additionally, when using it in BepInEx (a Unity modding tool), I see this error:

An exception was thrown by the type initializer for SDLS.JSON  
[Info   :   Console] Stack trace:   at SDLS.Plugin.TrashAllJSON () [0x00000] in <filename unknown>:0  
  at SDLS.Plugin.Initialization () [0x00000] in <filename unknown>:0  

This happens specifically when I add the following line:

private static readonly JsonFormatter jsonFormatterSwift = new JsonFormatter();

MagicJinn avatar Nov 22 '24 19:11 MagicJinn