void CrawlStatic()
        {
            var crawlStatic        = new List <int>();
            var managedTypes       = m_Snapshot.managedTypes;
            var staticManagedTypes = new List <int>(1024);

            // Unity BUG: (Case 984330) PackedMemorySnapshot: Type contains staticFieldBytes, but has no static field
            for (int n = 0, nend = managedTypes.Length; n < nend; ++n)
            {
                var type = managedTypes[n];

                // Some static classes have no staticFieldBytes. As I understand this, the staticFieldBytes
                // are only filled if that static class has been initialized (its cctor called), otherwise it's zero.
                if (type.staticFieldBytes == null || type.staticFieldBytes.Length == 0)
                {
                    continue;
                }

                //var hasStaticField = false;
                for (int j = 0, jend = type.fields.Length; j < jend; ++j)
                {
                    if (!type.fields[j].isStatic)
                    {
                        continue;
                    }

                    //var field = type.fields[j];
                    //var fieldType = managedTypes[field.managedTypesArrayIndex];
                    //hasStaticField = true;

                    var item = new PackedManagedStaticField
                    {
                        managedTypesArrayIndex = type.managedTypesArrayIndex,
                        fieldIndex             = j,
                        staticFieldsArrayIndex = m_StaticFields.Count,
                    };
                    m_StaticFields.Add(item);

                    crawlStatic.Add(item.staticFieldsArrayIndex);
                }

                //if (hasStaticField)
                staticManagedTypes.Add(type.managedTypesArrayIndex);
            }

            m_Snapshot.managedStaticTypes = staticManagedTypes.ToArray();

            //var loopGuard = 0;
            while (crawlStatic.Count > 0)
            {
                //if (++loopGuard > 100000)
                //{
                //    m_snapshot.Error("Loop-guard kicked in while analyzing static fields.");
                //    break;
                //}

                m_TotalCrawled++;
                if ((m_TotalCrawled % 1000) == 0)
                {
                    UpdateProgress();
                    if (m_Snapshot.abortActiveStepRequested)
                    {
                        break;
                    }
                }

                var staticField = m_StaticFields[crawlStatic[crawlStatic.Count - 1]];
                crawlStatic.RemoveAt(crawlStatic.Count - 1);

                var staticClass  = m_Snapshot.managedTypes[staticField.managedTypesArrayIndex];
                var field        = staticClass.fields[staticField.fieldIndex];
                var fieldType    = m_Snapshot.managedTypes[field.managedTypesArrayIndex];
                var staticReader = new StaticMemoryReader(m_Snapshot, staticClass.staticFieldBytes);

                if (fieldType.isValueType)
                {
                    if (staticClass.staticFieldBytes == null || staticClass.staticFieldBytes.Length == 0)
                    {
                        continue;
                    }

                    var newObj = PackedManagedObject.New();
                    newObj.address = (ulong)field.offset;
                    // BUG: TODO: If staticFieldsArrayIndex=0, then it's detected as managedObject rather than staticField?
                    newObj.managedObjectsArrayIndex = -staticField.staticFieldsArrayIndex;
                    newObj.managedTypesArrayIndex   = fieldType.managedTypesArrayIndex;
                    newObj.staticBytes = staticClass.staticFieldBytes;
                    SetObjectSize(ref newObj, fieldType);

                    m_Crawl.Add(newObj);
                    m_TotalCrawled++;
                    continue;
                }

                // If it's a reference type, it simply points to a ManagedObject on the heap and all
                // we need to do it to create a new ManagedObject and add it to the list to crawl.
                if (!fieldType.isValueType)
                {
                    var addr = staticReader.ReadPointer((uint)field.offset);
                    if (addr == 0)
                    {
                        continue;
                    }

#if DEBUG_BREAK_ON_ADDRESS
                    if (addr == DebugBreakOnAddress)
                    {
                        int a = 0;
                    }
#endif

                    int newObjIndex;
                    if (!m_Seen.TryGetValue(addr, out newObjIndex))
                    {
                        var newObj = PackedManagedObject.New();
                        newObj.address = addr;
                        newObj.managedObjectsArrayIndex = m_ManagedObjects.Count;

                        // The static field could be a basetype, such as UnityEngine.Object, but actually point to a Texture2D.
                        // Therefore it's important to find the type of the specified address, rather than using the field type.
                        newObj.managedTypesArrayIndex = m_Snapshot.FindManagedObjectTypeOfAddress(addr);
                        if (newObj.managedTypesArrayIndex == -1)
                        {
                            newObj.managedTypesArrayIndex = fieldType.managedTypesArrayIndex;
                        }

                        // Check if the object has a GCHandle
                        var gcHandleIndex = m_Snapshot.FindGCHandleOfTargetAddress(addr);
                        if (gcHandleIndex != -1)
                        {
                            newObj.gcHandlesArrayIndex = gcHandleIndex;
                            m_Snapshot.gcHandles[gcHandleIndex].managedObjectsArrayIndex = newObj.managedObjectsArrayIndex;

                            m_Snapshot.AddConnection(PackedConnection.Kind.GCHandle, gcHandleIndex, PackedConnection.Kind.Managed, newObj.managedObjectsArrayIndex);
                        }
                        SetObjectSize(ref newObj, managedTypes[newObj.managedTypesArrayIndex]);
                        TryConnectNativeObject(ref newObj);

                        m_ManagedObjects.Add(newObj);
                        m_Seen[newObj.address] = newObj.managedObjectsArrayIndex;
                        m_Crawl.Add(newObj);
                        m_TotalCrawled++;
                        newObjIndex = newObj.managedObjectsArrayIndex;
                    }

                    m_Snapshot.AddConnection(PackedConnection.Kind.StaticField, staticField.staticFieldsArrayIndex, PackedConnection.Kind.Managed, newObjIndex);

                    continue;
                }
            }
        }