yasirkula/UnityAssetUsageDetector

Crash occurs during search (possibly scripting runtime related)

TimmermanV opened this issue · 2 comments

A crash occurs when using Scripting Runtime .NET 4.x Equivalent in Player Settings. No crash occurs when Scripting Runtime .NET 3.5 is used. Reproduced the issue 5 out of 5 times searching for audio clips and sprites. I left all search settings on their default values.

I'm using Unity 2019.1.8f1. The latest version of TextMeshPro requires .NET 4.x, so switching back is not an option for me unfortunately.

Here's the call stack of the crash:

InvalidCastException: Specified cast is not valid.
System.Reflection.Assembly.Equals (System.Object o) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Collections.Generic.ObjectEqualityComparer`1[T].LastIndexOf (T[] array, T value, System.Int32 startIndex, System.Int32 count) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Array.LastIndexOfImpl[T] (T[] array, T value, System.Int32 startIndex, System.Int32 count) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Array.LastIndexOf[T] (T[] array, T value, System.Int32 startIndex, System.Int32 count) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Array.LastIndexOf[T] (T[] array, T value, System.Int32 startIndex) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Collections.Generic.Stack`1[T].Contains (T item) (at <c9226b2f33b7421e85bb391f94075e49>:0)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:550)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchFieldsAndPropertiesOf (AssetUsageDetectorNamespace.ReferenceNode referenceNode) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:840)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:628)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchFieldsAndPropertiesOf (AssetUsageDetectorNamespace.ReferenceNode referenceNode) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:840)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:628)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchFieldsAndPropertiesOf (AssetUsageDetectorNamespace.ReferenceNode referenceNode) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:840)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:628)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchFieldsAndPropertiesOf (AssetUsageDetectorNamespace.ReferenceNode referenceNode) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:840)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchComponent (UnityEngine.Component component) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:738)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:599)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchGameObject (UnityEngine.GameObject go) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:669)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:597)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchFieldsAndPropertiesOf (AssetUsageDetectorNamespace.ReferenceNode referenceNode) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:840)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchComponent (UnityEngine.Component component) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:738)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:599)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchGameObject (UnityEngine.GameObject go) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:669)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchObject (System.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:597)
AssetUsageDetectorNamespace.AssetUsageDetector.BeginSearchObject (UnityEngine.Object obj) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:538)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchGameObjectRecursively (UnityEngine.GameObject go) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:523)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchGameObjectRecursively (UnityEngine.GameObject go) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:527)
AssetUsageDetectorNamespace.AssetUsageDetector.SearchScene (System.String scenePath, System.Collections.Generic.List`1[T] searchResult, UnityEditor.SceneManagement.SceneSetup[] initialSceneSetup) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:489)
AssetUsageDetectorNamespace.AssetUsageDetector.Run (AssetUsageDetectorNamespace.AssetUsageDetector+Parameters searchParameters) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:376)
UnityEngine.Debug:LogException(Exception)
AssetUsageDetectorNamespace.AssetUsageDetector:Run(Parameters) (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs:409)
AssetUsageDetectorNamespace.AssetUsageDetectorWindow:OnGUI() (at Assets/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorWindow.cs:258)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Apparently, System.Reflection.Assembly variables cause this issue on .NET 4.0. Should be fixed in 64408e3

Awesome. Thanks for the quick fix. Everything seems to be working now. And this new version appears quite a bit faster. Great!