Ejemplo n.º 1
0
        private ClrMDSession(DataTarget target, string dacFile)
        {
            ClrMDSession.Detach();

            if (target.ClrVersions.Count == 0)
            {
                throw new ArgumentException("DataTarget has no clr loaded.", nameof(target));
            }

            Target  = target;
            Runtime = dacFile == null ? target.ClrVersions[0].CreateRuntime() : target.ClrVersions[0].CreateRuntime(dacFile);
            Heap    = Runtime.Heap;

            //Temp hack until ErrorType is made public
            var property = Heap.GetType().GetProperty("ErrorType", BindingFlags.Instance | BindingFlags.NonPublic);

            if (property == null)
            {
                throw new InvalidOperationException("Unable to find 'ErrorType' property on ClrHeap.");
            }

            ErrorType = (ClrType)property.GetValue(Heap);

            m_allObjects = CreateLazyAllObjects();

            s_currentSession = this;
        }
Ejemplo n.º 2
0
        public void Dispose()
        {
            Target.Dispose();

            s_currentSession = null;
            s_lastDumpPath   = null;
            s_lastProcessId  = null;

            GC.SuppressFinalize(this);
        }
Ejemplo n.º 3
0
        public ClrMDSession(DataTarget target, ClrRuntime runtime)
        {
            ClrMDSession.Detach();

            Target  = target;
            Runtime = runtime;
            Heap    = Runtime.GetHeap();

            m_allObjects = new Lazy <List <ClrObject> >(() => Heap.EnumerateClrObjects().ToList());

            s_currentSession = this;
        }
Ejemplo n.º 4
0
        public ClrMDSession(DataTarget target, ClrRuntime runtime)
        {
            ClrMDSession.Detach();

            Target = target;
            Runtime = runtime;
            Heap = Runtime.GetHeap();

            m_allObjects = new Lazy<List<ClrObject>>(() => Heap.EnumerateClrObjects().ToList());

            s_currentSession = this;
        }
Ejemplo n.º 5
0
        public void Dispose()
        {
            Target.Dispose();

            s_currentSession = null;
            s_lastDumpPath = null;
            s_lastProcessId = null;

            GC.SuppressFinalize(this);
        }