Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Deep profiling causes "Non matching Profiler.EndSample"

Discussion in '2019.3 Beta' started by Peter77, Nov 30, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,588
    I was deep profiling EnterPlaymode in an empty Unity 2019.3.0f1 project, where the editor spits out the following errors:

    Code (CSharp):
    1. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ExitGUI()
    2. Previous 5 samples:
    3.     GC.Alloc
    4.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    5.     Mono.JIT
    6.     GC.Alloc
    7.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    8. In the scope:
    9.     UIElementsUtility.DoDispatch(Non Repaint Event)
    10.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    11.     EditorLoop
    12.     Main Thread
    13. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEditor.dll!UnityEditor::Toolbar.DoPlayButtons()
    14. Previous 5 samples:
    15.     GC.Alloc
    16.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    17.     Mono.JIT
    18.     GC.Alloc
    19.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    20. In the scope:
    21.     UIElementsUtility.DoDispatch(Non Repaint Event)
    22.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    23.     EditorLoop
    24.     Main Thread
    25. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEditor.dll!UnityEditor::Toolbar.OldOnGUI()
    26. Previous 5 samples:
    27.     GC.Alloc
    28.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    29.     Mono.JIT
    30.     GC.Alloc
    31.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    32. In the scope:
    33.     UIElementsUtility.DoDispatch(Non Repaint Event)
    34.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    35.     EditorLoop
    36.     Main Thread
    37. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::IMGUIContainer.DoOnGUI()
    38. Previous 5 samples:
    39.     GC.Alloc
    40.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    41.     Mono.JIT
    42.     GC.Alloc
    43.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    44. In the scope:
    45.     UIElementsUtility.DoDispatch(Non Repaint Event)
    46.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    47.     EditorLoop
    48.     Main Thread
    49. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::IMGUIContainer.HandleIMGUIEvent()
    50. Previous 5 samples:
    51.     GC.Alloc
    52.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    53.     Mono.JIT
    54.     GC.Alloc
    55.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    56. In the scope:
    57.     UIElementsUtility.DoDispatch(Non Repaint Event)
    58.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    59.     EditorLoop
    60.     Main Thread
    61. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::IMGUIContainer.HandleIMGUIEvent()
    62. Previous 5 samples:
    63.     GC.Alloc
    64.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    65.     Mono.JIT
    66.     GC.Alloc
    67.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    68. In the scope:
    69.     UIElementsUtility.DoDispatch(Non Repaint Event)
    70.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    71.     EditorLoop
    72.     Main Thread
    73. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::IMGUIContainer.SendEventToIMGUI()
    74. Previous 5 samples:
    75.     GC.Alloc
    76.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    77.     Mono.JIT
    78.     GC.Alloc
    79.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    80. In the scope:
    81.     UIElementsUtility.DoDispatch(Non Repaint Event)
    82.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    83.     EditorLoop
    84.     Main Thread
    85. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::IMGUIContainer.HandleEvent()
    86. Previous 5 samples:
    87.     GC.Alloc
    88.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    89.     Mono.JIT
    90.     GC.Alloc
    91.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    92. In the scope:
    93.     UIElementsUtility.DoDispatch(Non Repaint Event)
    94.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    95.     EditorLoop
    96.     Main Thread
    97. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::CallbackEventHandler.HandleEventAtTargetPhase()
    98. Previous 5 samples:
    99.     GC.Alloc
    100.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    101.     Mono.JIT
    102.     GC.Alloc
    103.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    104. In the scope:
    105.     UIElementsUtility.DoDispatch(Non Repaint Event)
    106.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    107.     EditorLoop
    108.     Main Thread
    109. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::MouseCaptureDispatchingStrategy.DispatchEvent()
    110. Previous 5 samples:
    111.     GC.Alloc
    112.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    113.     Mono.JIT
    114.     GC.Alloc
    115.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    116. In the scope:
    117.     UIElementsUtility.DoDispatch(Non Repaint Event)
    118.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    119.     EditorLoop
    120.     Main Thread
    121. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::EventDispatcher.ProcessEvent()
    122. Previous 5 samples:
    123.     GC.Alloc
    124.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    125.     Mono.JIT
    126.     GC.Alloc
    127.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    128. In the scope:
    129.     UIElementsUtility.DoDispatch(Non Repaint Event)
    130.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    131.     EditorLoop
    132.     Main Thread
    133. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::EventDispatcher.ProcessEventQueue()
    134. Previous 5 samples:
    135.     GC.Alloc
    136.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    137.     Mono.JIT
    138.     GC.Alloc
    139.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    140. In the scope:
    141.     UIElementsUtility.DoDispatch(Non Repaint Event)
    142.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    143.     EditorLoop
    144.     Main Thread
    145. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::EventDispatcher.OpenGate()
    146. Previous 5 samples:
    147.     GC.Alloc
    148.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    149.     Mono.JIT
    150.     GC.Alloc
    151.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    152. In the scope:
    153.     UIElementsUtility.DoDispatch(Non Repaint Event)
    154.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    155.     EditorLoop
    156.     Main Thread
    157. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::EventDispatcherGate.Dispose()
    158. Previous 5 samples:
    159.     GC.Alloc
    160.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    161.     Mono.JIT
    162.     GC.Alloc
    163.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    164. In the scope:
    165.     UIElementsUtility.DoDispatch(Non Repaint Event)
    166.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    167.     EditorLoop
    168.     Main Thread
    169. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::EventDispatcher.ProcessEvent()
    170. Previous 5 samples:
    171.     GC.Alloc
    172.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    173.     Mono.JIT
    174.     GC.Alloc
    175.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    176. In the scope:
    177.     UIElementsUtility.DoDispatch(Non Repaint Event)
    178.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    179.     EditorLoop
    180.     Main Thread
    181. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::EventDispatcher.Dispatch()
    182. Previous 5 samples:
    183.     GC.Alloc
    184.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    185.     Mono.JIT
    186.     GC.Alloc
    187.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    188. In the scope:
    189.     UIElementsUtility.DoDispatch(Non Repaint Event)
    190.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    191.     EditorLoop
    192.     Main Thread
    193. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::BaseVisualElementPanel.SendEvent()
    194. Previous 5 samples:
    195.     GC.Alloc
    196.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    197.     Mono.JIT
    198.     GC.Alloc
    199.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    200. In the scope:
    201.     UIElementsUtility.DoDispatch(Non Repaint Event)
    202.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    203.     EditorLoop
    204.     Main Thread
    205. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::UIElementsUtility.DoDispatch()
    206. Previous 5 samples:
    207.     GC.Alloc
    208.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    209.     Mono.JIT
    210.     GC.Alloc
    211.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    212. In the scope:
    213.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    214.     EditorLoop
    215.     Main Thread
    216. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.UIElementsModule.dll!UnityEngine.UIElements::UIElementsUtility.ProcessEvent()
    217. Previous 5 samples:
    218.     GC.Alloc
    219.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    220.     Mono.JIT
    221.     GC.Alloc
    222.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    223. In the scope:
    224.     UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    225.     EditorLoop
    226.     Main Thread
    227. Non matching Profiler.EndSample (BeginSample and EndSample count must match): UnityEngine.IMGUIModule.dll!UnityEngine::GUIUtility.ProcessEvent()
    228. Previous 5 samples:
    229.     GC.Alloc
    230.     UnityEditor.dll!UnityEditor::SceneVisibilityState.GeneratePersistentDataForAllLoadedScenes()
    231.     Mono.JIT
    232.     GC.Alloc
    233.     UnityEditor.dll!::AssetStoreClientInternal.IsAnyDownloadInProgress()
    234. In the scope:
    235.     EditorLoop
    236.     Main Thread
    Reproduce
    1. Create new 3D project
    2. Open Profiler
    3. Enable "Editor" and "Deep Profile"
    4. Press Start
    Actual
    Observe Unity outputs several "Non matching Profiler.EndSample" errors.
     
    LeonhardP and alexeyzakharov like this.
  2. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi Peter,
    Thank you for reporting the issue!
    I happen to fix very similar issue recently https://issuetracker.unity3d.com/is...etween-the-profiler-window-and-the-scene-view which was related to mismatching begin/end due to exception being thrown in the UI (GUIUtility.ExitGUI() throws an exception).
    Although, the fix landed quite a while ago (2019.3b3) and supposedly should not be present in 2019.3.0f1.
    There is potentially some other unfixed issue, however, I can't reproduce it with the latest 2019.3.0f3 and repro steps you described.

    To clarify
    >Create new 3D project
    did you mean the default 3D template when creating a new project?
     
    Peter77 and LeonhardP like this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,588
    In Unity HUB the tile is just labled "3D", that's the project I used to create.
     
    alexeyzakharov likes this.
  4. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Thanks - I've created a bug on your behalf for the verification.
     
    Peter77 likes this.
  5. DDainys

    DDainys

    Unity Technologies

    Joined:
    May 26, 2017
    Posts:
    1
    Hello Peter,

    Thank you for taking the time to report this incident, and I hope you are having a good day. My name is Dovydas, and I will be helping you.

    Sadly I wasn't able to reproduce the incident. Does the issue reproduce with other project templates? Are you using a custom Editor layout or the default one?

    Any and all information would be greatly appreciated!
    If you have any questions, feel free to ask.

    Sincerely,
    Dovydas Dainys
    Customer QA Team
     
    LeonhardP, Peter77 and alexeyzakharov like this.
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,588
    Hello Dovydas,

    thank you for the reply.

    I've tried to reproduce the issue, but it does not reproduce anymore. I'll keep an eye open.
     
    alexeyzakharov and DDainys like this.