Newtonsoft.json: when I compile my unity player, it causes errors:PlatformNotSupportedException: Operation is not supported on this platform

Created on 16 Apr 2019  路  11Comments  路  Source: JamesNK/Newtonsoft.Json

Source/destination types

// Put the types you are serializing or deserializing here

Source/destination JSON

{"message":"Place your serialized or deserialized JSON here"}

Expected behavior

Actual behavior

Steps to reproduce

// Your calls to Newtonsoft.Json here

Newtonsoft.Json works well in Unity Editor, but it didn't work when I compile to Unity player, what should I do?
Error_2019_4_15_17h_17.txt

Most helpful comment

I encountered the same issue, but when i changed the "API Compatibility Level" to .Net 4.x, problem solved.

All 11 comments

is this a bug?

Ive got the same problem. I use BSon Serialization though. In the Editor everything works fine but when I compile, it gives me the same Error. I use the Serialization for RosBridge with RosSharp in Unity. I will go back to JSon Serialization and let you know if that changed anything.
Edit: Didn't change anything.

I encountered the same issue, but when i changed the "API Compatibility Level" to .Net 4.x, problem solved.

@superzscy Solved my issue too. This does not seem to have an impact on anything else. Does it?

Is there any movement on this issue? It seems like the library isn't correctly detecting that dynamic code generation isn't supported.

I'm getting this as of Jan 30/2020. I have read that setting the api compatibility level to .net 4.x will create issues on some platforms, eg, Linux, which I plan to deploy to.

  • is there a fix coming for this any time soon?
  • does anybody know if my concern about the .net 4.x compatibility level a valid one?

Same issue here

Same issue as well, changing to 4.x fixed it, but I am worried it will not work on linux?

Same issue as well. It's solved on window but stuck on linux. Any solution for linux?

I encountered the same issue, but when i changed the "API Compatibility Level" to .Net 4.x, problem solved.

You're my life saver!

I encountered the same issue, but when i changed the "API Compatibility Level" to .Net 4.x, problem solved.

Changing "API Compatibility Level" in Unity configuration to .NET 4.x solved my issue, too. Thank you @superzscy

Was this page helpful?
0 / 5 - 0 ratings