jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
111 stars 27 forks source link

FullInspector throws TypeInitializationException when starting Unity with externally modified source #135

Closed Arakade closed 8 years ago

Arakade commented 8 years ago

Hi, I installed the FullInspector trial to evaluate it for Dictionary serialization. It's doing that part of the job brilliantly (I'm using and loving the Generics-based approach). However I also occasionally get a spurious error.

System.TypeInitializationException: An exception was thrown by the type initializer for FullInspector.fiSettings ---> System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. (and) System.TypeInitializationException: An exception was thrown by the type initializer for FullInspector.Internal.fiInstalledSerializerManager ---> System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. (full details below)

I say spurious because restarting Unity resolves it. I wasn't having the issue before FI integration. FI appears in the errors. For these reasons, I suspect it is causal but I haven't determined why yet. I've only seen the error when starting Unity having uncompiled changes in my source. Unity shows its compiling and importing scripts dialogs then (erroneously) asks whether to load the default layout (the first indication that a compilation error has occurred). I know there isn't one because (a) I compiled successfully in Visual Studio, (b) looking through the errors, they aren't compilation ones and (c) restarting Unity shows it's all fine.

Unity 5.1.2f Indie on Windows 8.1

I've extracted log message below -- it contains tonnes of (A), a few (B) (BehaviorDesigner being one of many other assets in this project) then (C) which implicates Full Inspector. After these are the messages about loading a different layout.

Obviously the workaround is not to modify source while Unity isn't loaded but that's (a) not really viable for a multi-person version-control using team and (b) annoying to remember as a one-man!

Any thoughts on resolving would be greatly appreciated. Rupert.

A:

FileNotFoundException: Could not load file or assembly 'Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

(Filename:  Line: -1)

B:

TypeLoadException: Could not load type 'BehaviorDesigner.Editor.NodeDesigner' from assembly 'BehaviorDesignerEditor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

(Filename:  Line: -1)

C:

Refreshing native plugins compatible for Editor in 0.25 ms, found 0 plugins.
Platform assembly: C:\Program Files\Unity512\Editor\Data\Managed\Mono.Cecil.dll (this message is harmless)
Platform assembly: C:\Program Files\Unity512\Editor\Data\Managed\Unity.SerializationLogic.dll (this message is harmless)
Platform assembly: C:\Program Files\Unity512\Editor\Data\Mono\lib\mono\2.0\UnityScript.dll (this message is harmless)
Platform assembly: C:\Program Files\Unity512\Editor\Data\Managed\ICSharpCode.NRefactory.dll (this message is harmless)
System.TypeInitializationException: An exception was thrown by the type initializer for FullInspector.fiSettings ---> 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 /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/Assembly.cs:371 

  at FullInspector.Internal.fiRuntimeReflectionUtility.<GetAssemblyInstances>b__1[fiSettingsProcessor] (System.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator14`3[System.Reflection.Assembly,System.Type,<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type],FullInspector.fiSettingsProcessor].MoveNext () [0x00000] in <filename unknown>:0 

  at FullInspector.fiSettings..cctor () [0x00000] in <filename unknown>:0 

  --- End of inner exception stack trace ---

  at FullInspector.Internal.CompilationDetector..cctor () [0x00000] in <filename unknown>:0 
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogError(Object)
UnityEditor.EditorAssemblies:ProcessEditorInitializeOnLoad(Type) (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:116)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes() (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:128)
UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[]) (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:63)

(Filename: C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs Line: 116)

System.TypeInitializationException: An exception was thrown by the type initializer for FullInspector.fiSettings ---> 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 /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/Assembly.cs:371 

  at FullInspector.Internal.fiRuntimeReflectionUtility.<GetAssemblyInstances>b__1[fiSettingsProcessor] (System.Reflection.Assembly assembly) [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator14`3[System.Reflection.Assembly,System.Type,<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type]].MoveNext () [0x00000] in <filename unknown>:0 

  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[<>f__AnonymousType0`2[System.Reflection.Assembly,System.Type],FullInspector.fiSettingsProcessor].MoveNext () [0x00000] in <filename unknown>:0 

  at FullInspector.fiSettings..cctor () [0x00000] in <filename unknown>:0 

  --- End of inner exception stack trace ---

  at FullInspector.Internal.CompilationDetector..cctor () [0x00000] in <filename unknown>:0 
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogError(Object)
UnityEditor.EditorAssemblies:ProcessEditorInitializeOnLoad(Type) (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:116)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes() (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:128)
UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[]) (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:63)

(Filename: C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs Line: 116)

Downloading http://update.unity3d.com/5.1/ivy.xml to C:\Users\Rupert\AppData\Local\Temp\unity\23c1e52e-71d5-4073-8227-4741832be31f\ivy.xml

Platform assembly: C:\Program Files\Unity512\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.Compiler.dll (this message is harmless)
Platform assembly: C:\Program Files\Unity512\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.dll (this message is harmless)
Platform assembly: C:\Program Files\Unity512\Editor\Data\Mono\lib\mono\2.0\Boo.Lang.Parser.dll (this message is harmless)
Platform assembly: C:\Program Files\Unity512\Editor\Data\Mono\lib\mono\2.0\UnityScript.Lang.dll (this message is harmless)
Platform assembly: C:\Program Files\Unity512\Editor\Data\Mono\lib\mono\2.0\System.Xml.Linq.dll (this message is harmless)
System.TypeInitializationException: An exception was thrown by the type initializer for FullInspector.Internal.fiInstalledSerializerManager ---> 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 /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/Assembly.cs:371 

  at FullInspector.Internal.TypeCache.TryIndirectTypeLookup (System.String typeName, System.Type& type) [0x00000] in <filename unknown>:0 

  at FullInspector.Internal.TypeCache.FindType (System.String name, System.String assemblyHint) [0x00000] in <filename unknown>:0 

  at FullInspector.Internal.TypeCache.FindType (System.String name) [0x00000] in <filename unknown>:0 

  at FullInspector.Internal.fiInstalledSerializerManager.TryGetLoadedSerializerType (fiILoadedSerializers& serializers) [0x00000] in <filename unknown>:0 

  at FullInspector.Internal.fiInstalledSerializerManager..cctor () [0x00000] in <filename unknown>:0 

  --- End of inner exception stack trace ---

  at FullInspector.Internal.fiSerializerManagerEditorWindow..cctor () [0x00000] in <filename unknown>:0 
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogError(Object)
UnityEditor.EditorAssemblies:ProcessEditorInitializeOnLoad(Type) (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:116)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes() (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:128)
UnityEditor.EditorAssemblies:SetLoadedEditorAssemblies(Assembly[]) (at C:\buildslave\unity\build\Editor\Mono\EditorAssemblies.cs:63)

(Filename: C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs Line: 11
`
jacobdufault commented 8 years ago

This looks fixable on my end. It looks the the crash is happening while fiSettings is probing for any fiSettingsProcessors. I'll get to it soonish, though it might take a bit longer to push out the trial update (currently it's pretty painful to the update the trial - I'm not sure of a good way to automate it).

jacobdufault commented 8 years ago

This should be fixed and will be included in the next FI trial / update.

Arakade commented 8 years ago

Great that you've fixed it :) Just checked and the trail seems unchanged (by MD5). Understand it's low priority -- NP -- roughly when do you think I might retry to confirm? Thanks.

jacobdufault commented 8 years ago

Can you send me an email? Thanks.