private void ShowThreads() { threadsGrid.BeginGridUpdate(); threadsGrid.ClearItems(); List <ThreadWrapper> threads = NuGenDebugEventHandler.Instance.EventObjects.Controller.EnumerateThreads(); foreach (ThreadWrapper thread in threads) { EvaluatedThreadName = "<no name>"; ValueWrapper threadObject = null; ValueWrapper dereferencedObject = null; if (!HasSearchedForNameMethod) { threadObject = thread.GetObject(); if (threadObject != null && !threadObject.IsNull()) { dereferencedObject = threadObject.DereferenceValue(); if (dereferencedObject != null) { ClassWrapper threadClass = dereferencedObject.GetClassInformation(); uint threadTypeToken = threadClass.GetToken(); ModuleWrapper module = threadClass.GetModule(); FindGetThreadNameMethod(threadTypeToken, module); } } } if (HasSearchedForNameMethod) { if (GetThreadNameMethod == null) { EvaluatedThreadName = "<definition of the Thread class is not loaded>"; } else { if (threadObject == null) { threadObject = thread.GetObject(); if (threadObject != null && !threadObject.IsNull()) { dereferencedObject = threadObject.DereferenceValue(); } } if (dereferencedObject != null) { FrameWrapper threadActiveFrame = thread.GetActiveFrame(); if (threadActiveFrame != null) { NuGenFrameRefresher threadActiveFrameRefresher = new NuGenFrameRefresher(thread, threadActiveFrame.ChainIndex, threadActiveFrame.FrameIndex, threadActiveFrame.IsActiveFrame); GetThreadName(thread, threadObject, threadActiveFrameRefresher); } } } } GridEXRow row = threadsGrid.AddItem(); uint threadID = thread.GetID(); GridEXCell idCell = row.Cells[0]; NuGenHelperFunctions.TaggedObjects.Add((int)idCell.Value, threadID); idCell.Value = NuGenHelperFunctions.FormatNumber(threadID); row.Cells[1].Value = EvaluatedThreadName; AppDomainWrapper appDomain = thread.GetAppDomain(); if (appDomain != null) { row.Cells[2].Value = appDomain.GetName(); } NuGenHelperFunctions.TaggedObjects.Add((String)row.Cells[1].Value + (String)row.Cells[2].Value, thread); } threadsGrid.EndGridUpdate(); }