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; }
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; }