Search Unity

Bug Exception when opening snapshot from device

Discussion in 'Profiler Previews' started by hexaust_, May 30, 2019.

  1. hexaust_

    hexaust_

    Joined:
    Mar 7, 2015
    Posts:
    23
    I am using Unity 2018.4.0f1 with Memory Profiler 0.1.0-preview.6 on macOS.

    When I try to open a captured snapshot from a device I get this exception:


    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. Rethrow as Exception: Index was outside the bounds of the array.
    If I try to open an Editor snapshot everything works.

    This is the stack:
    Code (CSharp):
    1. [Exception] IndexOutOfRangeException: Index was outside the bounds of the array.
    2. Rethrow as Exception: Index was outside the bounds of the array.
    3. Crawler.ParseObjectHeader()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:825
    4. 823:   for (int i = 0; i != 8; ++i)
    5. 824:   {
    6. -->825:       var b = cursor.bytes[cursor.offset + i];
    7. 826:       str += string.Format(" {0:X2}", b);
    8. 827:   }
    9.  
    10. Crawler.ParseObjectHeader()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:774
    11. 772:   var heap = snapshot.managedHeapSections;
    12. 773:   var boHeader = heap.Find(ptrObjectHeader, snapshot.virtualMachineInformation);
    13. -->774:   var objectInfo = ParseObjectHeader(snapshot, boHeader, ignoreBadHeaderError);
    14. 775:   objectInfo.PtrObject = ptrObjectHeader;
    15. 776:   return objectInfo;
    16.  
    17. Crawler.ParseObjectHeader()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:757
    18. 755:   {
    19. 756:       var index = objectInfo.ManagedObjectIndex;
    20. -->757:       objectInfo = ParseObjectHeader(snapshot, ptrObjectHeader, ignoreBadHeaderError);
    21. 758:       objectInfo.ManagedObjectIndex = index;
    22. 759:       objectList[index] = objectInfo;
    23.  
    24. Crawler.CrawlPointer()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:667
    25. 665:   bool wasAlreadyCrawled;
    26. -->667:   obj = ParseObjectHeader(snapshot, data.ptr, out wasAlreadyCrawled, false);
    27. 668:   ++obj.RefCount;
    28.  
    29. Crawler+<Crawl>d__3.MoveNext()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:437
    30. 435:   while (crawlData.CrawlDataStack.Count > 0)
    31. 436:   {
    32. -->437:       CrawlPointer(crawlData);
    33. 438:   }
    34.  
    35. UIState+SnapshotMode.SetSnapshot()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/UIState.cs:158
    36. 156:   var status = crawling.Current as EnumerationStatus;
    37. 157:   float progressPerStep = 1.0f / status.StepCount;
    38. -->158:   while (crawling.MoveNext())
    39. 159:   {
    40. 160:       ProgressBarDisplay.UpdateProgress(status.CurrentStep * progressPerStep, status.StepStatus);
    41.  
    42. Unity.MemoryProfiler.Editor.UI.UIState+SnapshotMode..ctor()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/UIState.cs:127
    43. 125:   {
    44. 126:       dataRenderer.PrettyNamesOptionChanged += UpdateTableSelectionNames;
    45. -->127:       SetSnapshot(dataRenderer, snapshot);
    46. 128:   }
    47.  
    48. UIState.SetFirstSnapshot()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/UIState.cs:511
    49. 509:       SecondMode = FirstMode;
    50. 510:   }
    51. -->511:   FirstMode = new SnapshotMode(DataRenderer, snapshot);
    52. 513:   // Make sure that the first mode is shown and that ModeChanged (fired by ShownMode if set to something different) is fired.
    53.  
    54. OpenSnapshotsManager.OpenSnapshot()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/OpenSnapshotsManager.cs:79
    55. 77:       if (loadedPackedSnapshot != null)
    56. 78:       {
    57. -->79:           m_UIState.SetFirstSnapshot(loadedPackedSnapshot);
    58. 80:       }
    59. 81:   }
    60.  
    61. MemoryProfilerWindow.OpenCapture()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/MemoryProfilerWindow.cs:998
    62. 996:       MemoryProfilerAnalytics.StartEvent<MemoryProfilerAnalytics.LoadedSnapshotEvent>();
    63. -->998:       m_OpenSnapshots.OpenSnapshot(snapshot);
    64. 999:       MemoryProfilerAnalytics.EndEvent(new MemoryProfilerAnalytics.LoadedSnapshotEvent());
    65. 1000:   }
    66.  
    67. DebugUtility.GetExceptionHelpMessage()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Debuging/DebugUtility.cs:39
    68. 37:           {
    69. 38:   #if MEMPROFILER_DEBUGCHECK
    70. -->39:               throw new System.Exception(e.Message, e);
    71. 40:   #else
    72. 41:               return "Unhandled exception. To get additional information add in project settings \"scripting define symbols\" : MEMPROFILER_DEBUGCHECK\n"
    73.  
    74. MemoryProfilerWindow.OpenCapture()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/MemoryProfilerWindow.cs:1008
    75. 1006:       catch (Exception e)
    76. 1007:       {
    77. -->1008:           throw new Exception(DebugUtility.GetExceptionHelpMessage(e));
    78. 1009:       }
    79. 1010:   }
    80.  
    81. MemoryProfilerWindow+<>c__DisplayClass70_0.<AddSnapshotToUI>b__1()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/MemoryProfilerWindow.cs:462
    82. 460:       closeButton = snapshotListItem.Q<Button>("closeSnapshotButton", k_SnapshotButtonClassName),
    83. 461:   };
    84. -->462:   snapshot.GuiData.dynamicVisualElements.openButton.clickable.clicked += () => OpenCapture(snapshot);
    85. 463:   snapshot.GuiData.dynamicVisualElements.optionDropdownButton.AddManipulator(new Clickable(() => OpenSnapshotOptionMenu(snapshot)));
    86. 464:   snapshot.GuiData.dynamicVisualElements.closeButton.clickable.clicked += () => m_OpenSnapshots.CloseCapture(snapshot);
    87.  
    88. Clickable.OnMouseUp()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Clickable.cs:152
    89.  
    90. UnityEngine.Experimental.UIElements.EventCallbackFunctor`1[TEventType].Invoke()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventCallback.cs:62
    91.  
    92. EventCallbackRegistry.InvokeCallbacks()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventCallbackRegistry.cs:376
    93.  
    94. CallbackEventHandler.HandleEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:112
    95.  
    96. EventDispatcher.ProcessEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511
    97.  
    98. EventDispatcher.Dispatch()    /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307
    99.  
    100. BaseVisualElementPanel.SendEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:176
    101.  
    102. UIElementsUtility.DoDispatch()    /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245
    103.  
    104. UIElementsUtility.ProcessEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68
    105.  
    106. GUIUtility.ProcessEvent()    /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179
    107.  
     
  2. litefeel

    litefeel

    Joined:
    Dec 6, 2016
    Posts:
    45
    Yes, I also encountered the same problem.
    I am using Unity 2018.4.2f1 with Memory Profiler 0.1.0-preview.6 on Windows.
     
  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    310
    Hello,
    We do not appear to have any tickets tracking this issue yet. Can you please report this as a bug?
    Please attach the snapshot to that bug and post the case number here. :)
     
  4. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    310
    Hello again,
    We haven't received a bug ticket with a repro yet but we just released
    0.1.0-preview.7
    . Could you please check, if that version fixes it?

    If not, please report a bug through the bug reporter tool so we can address this issue.