needle-tools / selective-profiling

Selectively deep profile single methods while your game is running in Unity's Profiler 🔬
135 stars 11 forks source link

[Bug] Nullreference in Editor GUI code #11

Open marwie opened 3 years ago

marwie commented 3 years ago

Check why injection in some editor methods cause bugs, for example deep profiling in some IMGUI container events?!

NullReferenceException: Object reference not set to an instance of an object
  at (wrapper dynamic-method) UnityEngine.SliderHandler.UnityEngine.SliderHandler.HorizontalThumbRect_Patch0(UnityEngine.SliderHandler&)
  at (wrapper dynamic-method) UnityEngine.SliderHandler.UnityEngine.SliderHandler.ThumbRect_Patch0(UnityEngine.SliderHandler&)
  at (wrapper dynamic-method) UnityEngine.SliderHandler.UnityEngine.SliderHandler.OnRepaint_Patch0(UnityEngine.SliderHandler&)
  at (wrapper dynamic-method) UnityEngine.SliderHandler.UnityEngine.SliderHandler.Handle_Patch0(UnityEngine.SliderHandler&)
  at (wrapper dynamic-method) UnityEngine.GUI.UnityEngine.GUI.Slider_Patch0(UnityEngine.Rect,single,single,single,single,UnityEngine.GUIStyle,UnityEngine.GUIStyle,bool,int,UnityEngine.GUIStyle)
  at UnityEngine.GUI.HorizontalSlider (UnityEngine.Rect position, System.Single value, System.Single leftValue, System.Single rightValue, UnityEngine.GUIStyle slider, UnityEngine.GUIStyle thumb) [0x00001] in <c44e24cb7b9d4e5096e65a3281e887f5>:0 
  at UnityEngine.GUILayout.DoHorizontalSlider (System.Single value, System.Single leftValue, System.Single rightValue, UnityEngine.GUIStyle slider, UnityEngine.GUIStyle thumb, UnityEngine.GUILayoutOption[] options) [0x00013] in <c44e24cb7b9d4e5096e65a3281e887f5>:0 
  at UnityEngine.GUILayout.HorizontalSlider (System.Single value, System.Single leftValue, System.Single rightValue, UnityEngine.GUILayoutOption[] options) [0x00018] in <c44e24cb7b9d4e5096e65a3281e887f5>:0 
  at UnityEditor.GameView.DoZoomSlider () [0x00068] in <0c3742f371b24679bcaa6fcc508d0cca>:0 
  at UnityEditor.GameView.DoToolbarGUI () [0x00168] in <0c3742f371b24679bcaa6fcc508d0cca>:0 
  at UnityEditor.GameView.OnGUI () [0x00040] in <0c3742f371b24679bcaa6fcc508d0cca>:0 
  at UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) [0x00064] in <0c3742f371b24679bcaa6fcc508d0cca>:0 
  at UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) [0x00001] in <0c3742f371b24679bcaa6fcc508d0cca>:0 
  at UnityEditor.DockArea.OldOnGUI () [0x0019a] in <0c3742f371b24679bcaa6fcc508d0cca>: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) [0x0022c] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) [0x000c4] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () [0x00059] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) [0x000bb] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
Rethrow as ImmediateModeException
  at UnityEngine.UIElements.UIR.RenderChain.Render () [0x00151] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.UIRRepaintUpdater.Update () [0x00066] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) [0x0001e] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.Panel.UpdateForRepaint () [0x00035] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) [0x00098] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) [0x00023] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) [0x0003d] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) [0x0001a] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) [0x00001] in <1cdf5c2cc10149169242b9590b7ebb6b>:0 
  at UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) [0x00010] in <c44e24cb7b9d4e5096e65a3281e887f5>:0