Unity Unhandled Exception: DLL Compatibility Problem?

Forum for development eye controlled Unity 3D applications

Unity Unhandled Exception: DLL Compatibility Problem?

Postby john » 28 Feb 2014, 18:26

Hello,

I have been trying quite a few things and searching all over, but am unable to solve the following problem. I am working in Unity 4.3 and trying to implement the gazecam example in a new project as a way to learn more about how the system works.

There is an error occurring. It seems to involve the combination of creating a C# script and adding the Newtonsoft.Json DLL to the project. I can run the original project as downloaded from github, but any combination of trying to create a similar system in a new project leads to the following error (either by adding the json dll first, then creating a C# script - but not other kinds of scripts - or vice versa):

Code: Select all
Internal compiler error. See the console log for more information. output was:
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 <filename unknown>:0

  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0

  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0

  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0


At this point, I've deciphered the meaning behind a lot of functions and code in the sample project, but am at a complete loss as to how to get an original project actually running. This error makes it impossible to build in Unity and I haven't found any way to resolve the C#/json issue.

Do you have any advice for resolving this error?

Thanks for your help.
John
john
 
Posts: 8
Joined: 03 Jan 2014, 01:57

Re: Unity Unhandled Exception: DLL Compatibility Problem?

Postby john » 02 Mar 2014, 11:25

So, I went off to test out the provided dev documentation for connecting to TET without Unity. Both the SDK and manual methods from the "Getting Data" page worked fine in a plain Visual Studio solution separate from Unity. After reading up on many developers' trials and tribulations regarding Unity and JSON, I have learned there are many incompatibilities and difficulties to be encountered along those lines.

However, in response to my original post, I finally found a simple solution that allows the TET SDK to run in Unity without the noted error. The problem was that my new Unity project defaulted to using a subset of .NET 2.0, rather than the full version. To change this setting, go to Edit > Project Settings > Player, then in Inspector > Optimization heading > Api Compatibility Level dropbox, select .NET 2.0. An image is included for visual reference (click for full size).

John

Image
john
 
Posts: 8
Joined: 03 Jan 2014, 01:57

Re: Unity Unhandled Exception: DLL Compatibility Problem?

Postby Martin » 03 Mar 2014, 12:44

Hi john, thanks for posting the solution, I'm sure that will save some headache.
Martin
 
Posts: 567
Joined: 29 Oct 2013, 15:20

Re: Unity Unhandled Exception: DLL Compatibility Problem?

Postby MartinG » 18 Oct 2015, 08:16

I know this is pretty much an old thread, but I am an eyetribe and unity newby (nothing like jumping in the deep end) and I had the same problem. It had me stumped for ages. thanks so much for posting this fix ;)
MartinG
 
Posts: 1
Joined: 12 Jul 2015, 09:05

Re: Unity Unhandled Exception: DLL Compatibility Problem?

Postby Anders » 28 Oct 2015, 10:29

However, in response to my original post, I finally found a simple solution that allows the TET SDK to run in Unity without the noted error. The problem was that my new Unity project defaulted to using a subset of .NET 2.0, rather than the full version. To change this setting, go to Edit > Project Settings > Player, then in Inspector > Optimization heading > Api Compatibility Level dropbox, select .NET 2.0. An image is included for visual reference (click for full size).


Glad to see that you figured this out yourselves. The dependency is already mentioned in the Unity repos on our Github, but I'll see to it that it is made more clear in the future.
Anders
 
Posts: 124
Joined: 29 Oct 2013, 16:23


Return to Unity



cron