ManlyMarco / RuntimeUnityEditor

In-game inspector and debugging tools for applications made with Unity3D game engine
GNU General Public License v3.0
802 stars 98 forks source link

ReflectionTypeLoadException: The classes in the module cannot be loaded. #11

Closed Shoko84 closed 4 years ago

Shoko84 commented 4 years ago

I'm having an issue about injecting RuntimeUnityEditor for Enter The Gungeon, infinitely printing this error below each frame:

[Error  : Unity Log] ReflectionTypeLoadException: The classes in the module cannot be loaded.
Stack trace:
System.Reflection.Assembly.GetTypes ()
FullInspector.Internal.fiRuntimeReflectionUtility.<GetAssemblyInstances`1>m__0[fiSettingsProcessor] (System.Reflection.Assembly assembly)
System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator14`3[System.Reflection.Assembly,System.Type,<>__AnonType0`2[System.Reflection.Assembly,System.Type]].MoveNext ()
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>__AnonType0`2[System.Reflection.Assembly,System.Type]].MoveNext ()
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>__AnonType0`2[System.Reflection.Assembly,System.Type]].MoveNext ()
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>__AnonType0`2[System.Reflection.Assembly,System.Type]].MoveNext ()
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>__AnonType0`2[System.Reflection.Assembly,System.Type]].MoveNext ()
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>__AnonType0`2[System.Reflection.Assembly,System.Type]].MoveNext ()
System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[<>__AnonType0`2[System.Reflection.Assembly,System.Type],FullInspector.fiSettingsProcessor].MoveNext ()
FullInspector.fiSettings..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for FullInspector.fiSettings
FullInspector.FullSerializerSerializer.EmitFailWarning (fsResult result)
FullInspector.FullSerializerSerializer.Deserialize (System.Reflection.MemberInfo storageType, System.String serializedState, ISerializationOperator serializationOperator)
FullInspector.SerializationHelpers.DeserializeFromContent[FullSerializerSerializer] (System.Type storageType, System.String content)
FullInspector.SerializationHelpers.DeserializeFromContent[GameOptions,FullSerializerSerializer] (System.String content)
SaveManager.Load[GameOptions] (.SaveType saveType, .GameOptions& obj, Boolean allowDecrypted, UInt32 expectedVersion, System.Func`3 versionUpdater, Nullable`1 overrideSaveSlot)
GameOptions.Load ()
GameManager.get_Options ()
BraveCameraUtility.MaintainCameraAspect (UnityEngine.Camera c)
dfGUICamera.Awake ()

When I remove the .dlls (RuntimeUnityEditor.Core and RuntimeUnityEditor.Bepin5), the game works perfectly again.

Tested with:

I want to point out that the plugin works fine on Overcooked and Subnautica. Is it a known issue? I attempted to build the .dlls under .Net Framework 3.5 for testing purposes but no success.

ManlyMarco commented 4 years ago

It's most likely caused by mcs (used for REPL) embedded inside RuntimeUnityEditor.Core. Some of its types can fail to load depending on the runtime, and if the game tries to load all available types it will fail because of it. I'm planning on separating the REPL code, that should fix this problem since you'll be able to remove mcs by itself.

ManlyMarco commented 4 years ago

@Shoko84 Can you test if the latest release fixes this issue?