JakubNei / mcs-ICodeCompiler

Fully C# mannaged ICodeCompiler implementation that uses modified MCS (Mono C# compiler) usable in Unity.
Other
140 stars 37 forks source link

Unhandled Exception: System.Reflection.ReflectionTypeLoadException #1

Closed cjburkey01 closed 7 years ago

cjburkey01 commented 8 years ago

I get this error after adding your project to unity. I am using Unity 5, which may be the issue. Here's the full 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 <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 
feuerball11 commented 8 years ago

I get the same Error. I'm Using Unity 5.3.4f1. Build Target is WebGl. Do You know how long it could take till its fixed?

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 
The class System.CodeDom.Compiler.IndentedTextWriter could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
JakubNei commented 8 years ago

It works for me in Unity 5.3.4f1 (build target: Standalone).

As far as I know there is currently no (easy) way runtime code generation/loading can work in WebGL. As it has to go from C# to C++ to JavaScript.

If you however absolutely must load some kind of scripts at runtime, you can look for other fully made in C# scripting engines.

If you however have any idea, please tell me. If you mannage to fix it, please do a pull request.

cjburkey01 commented 8 years ago

I'm looking into MoonSharp, I haven't tried it though.

JakubNei commented 8 years ago

Not sure, it might be possible to do some black magic: Transcompile C# into Java and run it in https://www.ikvm.net/