Search Unity

Bug 2022.3 - Editor SearchContext constantly throwing unhandled exceptions during recompile

Discussion in 'Editor & General Support' started by Taro_FFG, Jun 2, 2023.

  1. Taro_FFG

    Taro_FFG

    Joined:
    Jun 24, 2022
    Posts:
    57
    We just upgraded to 2022.3 from 2022.1.
    Everytime I'm connected to the Editor with the debugger and recompile code changes I'm getting between 5 and 10 unhandled NullReferenceExceptions from

    SearchContext.EndSession and SearchContext.OnBeforeSerialize()

    which makes using the debugger in the Editor extremely painful as it is stopping the domain reload.

    It was annoying in 2022.1 but now in 2022.3.0 it is much worse.

    Since this class class is across the board not handling exceptions it is not clear if this is a problem with our project specifically or a general issue.
     
  2. sebastienp_unity

    sebastienp_unity

    Unity Technologies

    Joined:
    Feb 16, 2018
    Posts:
    201
    Could you share your project? Or provide us with a project that repro this bug? this is the first time I see hears that these functions are throwing exceptions.

     
  3. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi! Do you have some callstacks you could share? Does it only happens when you are connected with the debugger?
     
  4. Taro_FFG

    Taro_FFG

    Joined:
    Jun 24, 2022
    Posts:
    57
    My full production project is too big to submit a bug.
    We have Domain Reloading disabled, I assume this is one reason why this happens to us.
    I'm not able to reproduce it in a completely empty project.


    As far as I can tell we get three different exceptions in SearchContext, both called from native.
    I assume the transition surpresses exceptions when not connected with a debugger.

    The amount of exceptions I get per compile varies a lot. Typically between 5-15.


    The first exception callstack is:
    Code (CSharp):
    1. System.NullReferenceException: Object reference not set to an instance of an object
    2.   at UnityEditor.Search.SearchContext.UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize () [0x00048] in <73c0bbd319d24c4aa815da82ee2cf321>:0


    The second:


    Code (CSharp):
    1. System.NullReferenceException: Object reference not set to an instance of an object
    2.   at UnityEditor.Search.SearchContext.EndSession () [0x00007] in <73c0bbd319d24c4aa815da82ee2cf321>:0
    3.   at UnityEditor.Search.SearchContext.Dispose (System.Boolean disposing) [0x0000f] in <73c0bbd319d24c4aa815da82ee2cf321>:0
    4.   at UnityEditor.Search.SearchContext.Finalize () [0x00002] in <73c0bbd319d24c4aa815da82ee2cf321>:0
    The line here is 476 (this.sessions.StopAllAsyncSearchSessions(); )

    The third (almost the same as 2)

    Code (CSharp):
    1. System.NullReferenceException: Object reference not set to an instance of an object
    2.   at UnityEditor.Search.SearchContext.EndSession () [0x0001a] in <73c0bbd319d24c4aa815da82ee2cf321>:0
    3.   at UnityEditor.Search.SearchContext.Dispose (System.Boolean disposing) [0x0000f] in <73c0bbd319d24c4aa815da82ee2cf321>:0
    4.   at UnityEditor.Search.SearchContext.Finalize () [0x00002] in <73c0bbd319d24c4aa815da82ee2cf321>:0
    The line here is 478 (foreach (SearchProvider provider in this.m_Providers) )

    In 2022.1 I had similar exceptions but far less overall.
     
  5. F4t1h

    F4t1h

    Joined:
    Nov 12, 2017
    Posts:
    14
    Having the same issue here, since upgrading from 2021 LTS to 2022 LTS. The Editor pops 12 of these Errors at once seemingly randomly. I even tried reinstalling the searcher package, but nothing changed. Really frustrating due to the fact that I can't debug the project anymore without resuming endless times within Rider due to these errors.
     
  6. F4t1h

    F4t1h

    Joined:
    Nov 12, 2017
    Posts:
    14
    Any news regarding this? Still having the issue.


    Code (CSharp):
    1. System.NullReferenceException: Object reference not set to an instance of an object
    2.   at UnityEditor.Search.SearchContext.EndSession () [0x00007] in <a31a7d6e66d648f8a9a4126ebd0e0ed7>:0
    3.   at UnityEditor.Search.SearchContext.Dispose (System.Boolean disposing) [0x0000f] in <a31a7d6e66d648f8a9a4126ebd0e0ed7>:0
    4.   at UnityEditor.Search.SearchContext.Finalize () [0x00002] in <a31a7d6e66d648f8a9a4126ebd0e0ed7>:0
     
  7. ACCIAIO

    ACCIAIO

    Joined:
    Oct 8, 2017
    Posts:
    17
    Same here, whenever i click on the object selector it just spews nullref exceptions because it appears it has no search context (It's difficult to tell from the stacktrace, I had to debug to finds the issue)
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.Search.ObjectField.ShowObjectSelector () (at <8555578a98c24bf29160572106ba854d>:0)
    3. UnityEditor.Search.ObjectField+ObjectFieldSelector.ExecuteDefaultAction (UnityEngine.UIElements.EventBase evt) (at <8555578a98c24bf29160572106ba854d>:0)
    4. UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <f67debe1efd242948106f1922bfac1c7>:0)
    5. UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <f67debe1efd242948106f1922bfac1c7>:0)
    6. UnityEngine.UIElements.CallbackEventHandler.UnityEngine.UIElements.IEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <f67debe1efd242948106f1922bfac1c7>:0)
    7. UnityEngine.UIElements.EventDispatchUtilities.ExecuteDefaultAction (UnityEngine.UIElements.EventBase evt) (at <f67debe1efd242948106f1922bfac1c7>:0)
    8. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <f67debe1efd242948106f1922bfac1c7>:0)
    9. UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <f67debe1efd242948106f1922bfac1c7>:0)
    10. UnityEngine.UIElements.EventDispatcher.OpenGate () (at <f67debe1efd242948106f1922bfac1c7>:0)
    11. UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <f67debe1efd242948106f1922bfac1c7>:0)
    12. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <f67debe1efd242948106f1922bfac1c7>:0)
    13. UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <f67debe1efd242948106f1922bfac1c7>:0)
    14. UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <f67debe1efd242948106f1922bfac1c7>:0)
    15. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <f67debe1efd242948106f1922bfac1c7>:0)
    16. UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <f67debe1efd242948106f1922bfac1c7>:0)
    17. UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <f67debe1efd242948106f1922bfac1c7>:0)
    18. UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <f67debe1efd242948106f1922bfac1c7>:0)
    19. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <3787173144ff4a19b1a55d5938e19421>:0)