Page 1 of 1

Unhandled Exception: System.Reflection.ReflectionTypeLoadExc

PostPosted: 31 Mar 2016, 01:08
by mbajema
I am using Unity Pro 5.3.4 and OS X 10.10.5. I suddenly started getting a System.Reflection error. I updated to Unity 5.3.4 a couple days ago and everything was working until this morning when I got to work I was getting these errors associated with the Newtonsoft.Json int the Eyetribe/Plugins folder.

The following assembly referenced from This was a file path I removed for privacy reasons/Plugins/Newtonsoft.Json.dll could not be loaded: Assembly: System.Runtime.Serialization (assemblyref_index=6) Version: 3.0.0.0 Public Key: b77a5c561934e089 The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (This was a file path I removed for privacy reasons).

Could not load file or assembly 'System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The following assembly referenced from This was a file path I removed for privacy reasons/Newtonsoft.Json.dll could not be loaded: Assembly: System.Xml.Linq (assemblyref_index=5) Version: 3.5.0.0 Public Key: b77a5c561934e089 The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (This was a file path I removed for privacy reasons).

I was able to fix the errors above by putting System.Xml.Linq.dll and System.Serialization.dll in the folder with the plugin. I was not able to find these on my Mac system though. I had to copy it from an installation of Unity on Windows. It just seemed like MonoDevelop couldn't find what it was looking for. I don't know how to fix the following error.

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool) at System.Reflection.Assembly.GetTypes () [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0 at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0 at Mono.CSharp.Driver.Compile () [0x00000] in :0 at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0

The class System.ComponentModel.INotifyPropertyChanging could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 The class System.ComponentModel.AddingNewEventHandler could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 The class JTokenReferenceEqualityComparer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JContainer could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class JPropertyList could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JArray could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JObject could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class Newtonsoft.Json.Linq.JProperty could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class d_4`2 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class df`2 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class d0 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class d2 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class d0 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed The class <>c_DisplayClass2 could not be loaded, used in Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed

Re: Unhandled Exception: System.Reflection.ReflectionTypeLoa

PostPosted: 05 Apr 2016, 15:33
by Anders
I believe this was answered in this thread.

This will be better documented in the next EyeTribe C# SDK release.

I recommend using the unity example as basis for your project.

Re: Unhandled Exception: System.Reflection.ReflectionTypeLoa

PostPosted: 05 Apr 2016, 22:00
by mbajema
Thank you for your response. I had already updated that setting. There are known issues with Newtonsoft.Json in Unity I guess.

This issue kind of mysteriously went away just like it came.

Re: Unhandled Exception: System.Reflection.ReflectionTypeLoa

PostPosted: 06 Apr 2016, 09:47
by Anders
To elaborate, the Newtonsoft.Json uses reflection which is not part of the .Net 2.0 subset default setting in Unity. Hence the change is needed.