MerlinVR / UdonSharp

An experimental compiler for compiling C# to Udon assembly
MIT License
678 stars 89 forks source link

Class exposure tree take forever to Processing methods and types. #94

Closed IkaWaAyuMu closed 3 years ago

IkaWaAyuMu commented 3 years ago

Describe the bug in detail: Class exposure tree take forever to Processing methods and types on Unity 2019. As shown in Additional Information Need to close the unity entirely to exit from loop hell.

Provide steps/code to reproduce the bug:

  1. Import The first Engine Update beta SDK
  2. Import Udonsharp v0.20.1 Pre release
  3. Open class exposure tree.

Expected behavior: The class exposure tree window working correctly as on Unity 2018.

Additional Information:

https://user-images.githubusercontent.com/7066150/126484685-e389ed75-f602-4ba1-9d2b-82296b997e37.mp4

NarryG commented 3 years ago

I uncommented the log lines and snagged a stacktrace.

(Filename: Assets/UdonSharp/Editor/Editors/UdonTypeExposureTree.cs Line: 745)

NullReferenceException: Object reference not set to an instance of an object
  at UdonSharp.Editors.UdonTypeExposureTreeView.AddChildNode (UnityEditor.IMGUI.Controls.TreeViewItem parentItem, System.Reflection.MemberInfo memberInfo, System.Int32& currentID) [0x00017] in C:\Users\Daniel\Documents\VRChat\VRCBenchmark\Assets\UdonSharp\Editor\Editors\UdonTypeExposureTree.cs:334 
  at UdonSharp.Editors.UdonTypeExposureTreeView.BuildRoot () [0x004bc] in C:\Users\Daniel\Documents\VRChat\VRCBenchmark\Assets\UdonSharp\Editor\Editors\UdonTypeExposureTree.cs:730 
  at UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () [0x00016] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () [0x00008] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () [0x00008] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () [0x00007] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.IMGUI.Controls.TreeView.Reload () [0x0001a] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UdonSharp.Editors.UdonTypeExposureTreeView..ctor (UnityEditor.IMGUI.Controls.TreeViewState state) [0x0005e] in C:\Users\Daniel\Documents\VRChat\VRCBenchmark\Assets\UdonSharp\Editor\Editors\UdonTypeExposureTree.cs:56 
  at UdonSharp.Editors.UdonTypeExposureTree.OnGUI () [0x00024] in C:\Users\Daniel\Documents\VRChat\VRCBenchmark\Assets\UdonSharp\Editor\Editors\UdonTypeExposureTree.cs:788 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <eae584ce26bc40229c1b1aa476bfa589>:0 
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) [0x0000f] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.HostView.Invoke (System.String methodName) [0x00001] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) [0x0007d] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) [0x00001] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEditor.DockArea.OldOnGUI () [0x001ac] in <bd70c40e01f641bdb7d836e1e97755bc>:0 
  at UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x0019c] in <a6a8a08b59d34373858eada2d852ad38>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.UIElements.IMGUIContainer:DoOnGUI(Event, Matrix4x4, Rect, Boolean, Rect, Action, Boolean)
UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent(Event, Matrix4x4, Rect, Action, Boolean)
UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint()
UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh(DrawParams, Boolean, Single, Exception&)
UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain(RenderChainCommand, Rect, Matrix4x4, PanelClearFlags, Texture, Texture, Texture, Single, NativeArray`1, NativeArray`1, Exception&)
UnityEngine.UIElements.UIR.UIRenderDevice:DrawChain(RenderChainCommand, Rect, Matrix4x4, PanelClearFlags, Texture, Texture, Texture, Single, NativeArray`1, NativeArray`1, Exception&)
UnityEngine.UIElements.UIR.RenderChain:Render(Rect, Matrix4x4, PanelClearFlags)
UnityEngine.UIElements.UIRRepaintUpdater:DrawChain(Rect, Matrix4x4)
UnityEngine.UIElements.UIRRepaintUpdater:Update()
UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase(VisualTreeUpdatePhase)
UnityEngine.UIElements.Panel:UpdateForRepaint()
UnityEngine.UIElements.Panel:Repaint(Event)
UnityEngine.UIElements.UIElementsUtility:DoDispatch(BaseVisualElementPanel)
UnityEngine.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) 

Caught the exception and the type it's dying on is "Int32 meshIndex"

  | Name | Value | Type
-- | -- | -- | --
◢ | memberInfo | "Int32 meshIndex" | System.Reflection.MemberInfo
  | ▶ base | "Int32 meshIndex" | System.Reflection.RuntimePropertyInfo
  | Attributes | None | System.Reflection.PropertyAttributes
  | CanRead | false | bool
  | CanWrite | true | bool
  | ▶ DeclaringType | {UnityEngine.ParticleSystem+EmitParams} | System.Type
  | Name | "meshIndex" | string
  | ▶ PropertyType | {System.Int32} | System.Type
  | ▶ ReflectedType | {UnityEngine.ParticleSystem+EmitParams} | System.Type