Exception when opening snapshot from device

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:

IndexOutOfRangeException: Index was outside the bounds of the array.
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:

[Exception] IndexOutOfRangeException: Index was outside the bounds of the array.
Rethrow as Exception: Index was outside the bounds of the array.
Crawler.ParseObjectHeader()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:825
823:   for (int i = 0; i != 8; ++i)
824:   {
-->825:       var b = cursor.bytes[cursor.offset + i];
826:       str += string.Format(" {0:X2}", b);
827:   }

Crawler.ParseObjectHeader()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:774
772:   var heap = snapshot.managedHeapSections;
773:   var boHeader = heap.Find(ptrObjectHeader, snapshot.virtualMachineInformation);
-->774:   var objectInfo = ParseObjectHeader(snapshot, boHeader, ignoreBadHeaderError);
775:   objectInfo.PtrObject = ptrObjectHeader;
776:   return objectInfo;

Crawler.ParseObjectHeader()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:757
755:   {
756:       var index = objectInfo.ManagedObjectIndex;
-->757:       objectInfo = ParseObjectHeader(snapshot, ptrObjectHeader, ignoreBadHeaderError);
758:       objectInfo.ManagedObjectIndex = index;
759:       objectList[index] = objectInfo;

Crawler.CrawlPointer()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:667
665:   bool wasAlreadyCrawled;
-->667:   obj = ParseObjectHeader(snapshot, data.ptr, out wasAlreadyCrawled, false);
668:   ++obj.RefCount;

Crawler+<Crawl>d__3.MoveNext()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Profiler/ManagedDataCrawler.cs:437
435:   while (crawlData.CrawlDataStack.Count > 0)
436:   {
-->437:       CrawlPointer(crawlData);
438:   }

UIState+SnapshotMode.SetSnapshot()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/UIState.cs:158
156:   var status = crawling.Current as EnumerationStatus;
157:   float progressPerStep = 1.0f / status.StepCount;
-->158:   while (crawling.MoveNext())
159:   {
160:       ProgressBarDisplay.UpdateProgress(status.CurrentStep * progressPerStep, status.StepStatus);

Unity.MemoryProfiler.Editor.UI.UIState+SnapshotMode..ctor()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/UIState.cs:127
125:   {
126:       dataRenderer.PrettyNamesOptionChanged += UpdateTableSelectionNames;
-->127:       SetSnapshot(dataRenderer, snapshot);
128:   }

UIState.SetFirstSnapshot()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/UIState.cs:511
509:       SecondMode = FirstMode;
510:   }
-->511:   FirstMode = new SnapshotMode(DataRenderer, snapshot);
513:   // Make sure that the first mode is shown and that ModeChanged (fired by ShownMode if set to something different) is fired.

OpenSnapshotsManager.OpenSnapshot()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/UI/OpenSnapshotsManager.cs:79
77:       if (loadedPackedSnapshot != null)
78:       {
-->79:           m_UIState.SetFirstSnapshot(loadedPackedSnapshot);
80:       }
81:   }

MemoryProfilerWindow.OpenCapture()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/MemoryProfilerWindow.cs:998
996:       MemoryProfilerAnalytics.StartEvent<MemoryProfilerAnalytics.LoadedSnapshotEvent>();
-->998:       m_OpenSnapshots.OpenSnapshot(snapshot);
999:       MemoryProfilerAnalytics.EndEvent(new MemoryProfilerAnalytics.LoadedSnapshotEvent());
1000:   }

DebugUtility.GetExceptionHelpMessage()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/Debuging/DebugUtility.cs:39
37:           {
38:   #if MEMPROFILER_DEBUGCHECK
-->39:               throw new System.Exception(e.Message, e);
40:   #else
41:               return "Unhandled exception. To get additional information add in project settings \"scripting define symbols\" : MEMPROFILER_DEBUGCHECK\n"

MemoryProfilerWindow.OpenCapture()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/MemoryProfilerWindow.cs:1008
1006:       catch (Exception e)
1007:       {
-->1008:           throw new Exception(DebugUtility.GetExceptionHelpMessage(e));
1009:       }
1010:   }

MemoryProfilerWindow+<>c__DisplayClass70_0.<AddSnapshotToUI>b__1()    Library/PackageCache/com.unity.memoryprofiler@0.1.0-preview.6/Editor/MemoryProfilerWindow.cs:462
460:       closeButton = snapshotListItem.Q<Button>("closeSnapshotButton", k_SnapshotButtonClassName),
461:   };
-->462:   snapshot.GuiData.dynamicVisualElements.openButton.clickable.clicked += () => OpenCapture(snapshot);
463:   snapshot.GuiData.dynamicVisualElements.optionDropdownButton.AddManipulator(new Clickable(() => OpenSnapshotOptionMenu(snapshot)));
464:   snapshot.GuiData.dynamicVisualElements.closeButton.clickable.clicked += () => m_OpenSnapshots.CloseCapture(snapshot);

Clickable.OnMouseUp()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Clickable.cs:152

UnityEngine.Experimental.UIElements.EventCallbackFunctor`1[TEventType].Invoke()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventCallback.cs:62

EventCallbackRegistry.InvokeCallbacks()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventCallbackRegistry.cs:376

CallbackEventHandler.HandleEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:112

EventDispatcher.ProcessEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511

EventDispatcher.Dispatch()    /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307

BaseVisualElementPanel.SendEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:176

UIElementsUtility.DoDispatch()    /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245

UIElementsUtility.ProcessEvent()    /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68

GUIUtility.ProcessEvent()    /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179

Yes, I also encountered the same problem.
I am using Unity 2018.4.2f1 with Memory Profiler 0.1.0-preview.6 on Windows.

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. :slight_smile:

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.