Json.Net on Unity3D ( .Net 2)

Feb 4, 2011 at 3:22 PM
Edited Feb 4, 2011 at 3:26 PM

Hi i would like to use Json.Net on Unity3D.

I tried the 4.0 Release of Newtonsoft.Json.Net20 but Mono and Unity say that it's a .Net 4 dll

So i tried the 3.8 and 3.7 and both throw me this error : 

 

Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.TypeLoadException: Could not load type 'System.ComponentModel.TypeDescriptionProviderAttribute' from assembly 'Newtonsoft.Json.Net20.Merged'.

  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)

  at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType) [0x00000] in <filename unknown>:0 

  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0 

  at System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.AttributeTester.GetObsoleteAttribute (System.Type type) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Expression.ResolveAsTypeTerminal (IMemberContext ec, Boolean silent) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Expression.ResolveAsContextualType (IMemberContext rc, Boolean silent) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.LocalInfo.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Block.ResolveMeta (Mono.CSharp.BlockContext ec, Int32 offset) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.ToplevelBlock.ResolveMeta (Mono.CSharp.BlockContext ec, Mono.CSharp.ParametersCompiled ip) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in <filename unknown>:0 

 

So i if you have any ideas ? 

I also tried to compile and merge it myself with Visual 2010 but i got the same error.

So i guess it's not possible to use it on Unity? 

By the way, Mono don't seem to complain, and i found the System.ComponentModel.TypeDescriptionProviderAttribute' on Mono System dll.

...

Thanks

Feb 5, 2011 at 7:09 AM

i guess that someone is redefining System.ComponentModel.TypeDescriptionProviderAttribute on his assemblie 

So may i ask wich part of Json.net is using this?

The LinQbridge maybe? 
Jul 23, 2013 at 1:05 PM
Edited Jul 23, 2013 at 1:16 PM
Actually unity3D, which using Mono 2.6, does not exactly use C# 4.0. It just 3.5 with some 4.0 subset