I just upgraded from Unity 4.3.0 to 4.3.4 and now I am getting this error when I run my game:
An exception of type ‘System.MissingMethodException’ occurred in Unknown Module. but was not handled in user code
This is my line of code and I had been using Newtonsoft.Json without a problem until I upgraded…
// Turn the JSON into C# objects
highScoresResult = JsonConvert.DeserializeObject<HighScore[ ]>(rawJson);
I have changed nothing since 4.3.0… I have also exported to a clean directory… Is there something new that I need to know about ? I am assuming something has changed with the WP8 plugins ??
oh and i get this in the output window in Visual Studio:
InnerException: Could not load file or assembly ‘Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
AdditionalInfo:Invoking System.Collections.IEnumerator::MoveNext method with argument count: 0
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[ ] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[ ] parameters, Object[ ] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[ ] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[ ] parameters)
at WinRTBridge.MethodTools.InvokeMethod(Object instance, Int32 methodIndex, Object[ ] args)
It probably means that what it says - it couldn’t find assembly named ‘Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null’. The full name is very important, if even one character in that string in assembly name doesn’t match, it won’t be able to load it.
You may still get the missing method exception… JSON .NET uses Type.GetTypeCode (and a few other things) that were bugged in 4.3.3 and 4.3.4, so you may have to copy the WinRTLegacy.dll from the 4.3.2 version into your 4.3.4 install to workaround the issue.