MrJoy / UnityREPL

C# REPL tool for Unity3D built on Miguel's tool.
MIT License
101 stars 13 forks source link

Evaluator fails to load assemblies with .Net 4.x Equivalent Scripting Runtime #2

Open spacehamster opened 6 years ago

spacehamster commented 6 years ago

After setting the Scripting Runtime Version to .Net 4.x Equivalent, I get the following error

NullReferenceException: Object reference not set to an instance of an object
Mono.CSharp.PredefinedAttribute.Resolve (System.Boolean canFail) (at <c8c039196d284944be96b9057c4d6976>:0)
Mono.CSharp.TypeManager.IsThisOrFriendAssembly (System.Reflection.Assembly assembly) (at <c8c039196d284944be96b9057c4d6976>:0)
Mono.CSharp.Namespace.RegisterExternalExtensionMethodClass (System.Type type) (at <c8c039196d284944be96b9057c4d6976>:0)
Mono.CSharp.RootNamespace.RegisterExtensionMethodClass (System.Type t) (at <c8c039196d284944be96b9057c4d6976>:0)
Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) (at <c8c039196d284944be96b9057c4d6976>:0)
Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) (at <c8c039196d284944be96b9057c4d6976>:0)
Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) (at <c8c039196d284944be96b9057c4d6976>:0)
Mono.CSharp.Evaluator.ReferenceAssembly (System.Reflection.Assembly a) (at <c8c039196d284944be96b9057c4d6976>:0)
EvaluationHelper.TryLoadingAssemblies (System.Boolean isInitialized) (at Assets/Editor/UnityREPL/Evaluator.cs:35)
EvaluationHelper..ctor () (at Assets/Editor/UnityREPL/Evaluator.cs:21)
Shell..ctor () (at Assets/Editor/UnityREPL/Shell.cs:47)
UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String)
UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean)

This exception happens for all the assemblies from AppDomain.CurrentDomain.

MrJoy commented 6 years ago

Lovely. Chances are something major changed in how assembly loading is managed along the way. I'll try to take a look at this this weekend, but can't make any promises. If you happen to get things into working shape, I'd welcome a PR -- even if it's not super clean.