private DesktopBlockingObject CreateRWLObject(ulong obj, ClrType type) { if (type == null) { return(new DesktopBlockingObject(obj, false, 0, null, BlockingReason.None)); } ClrInstanceField writerID = type.GetFieldByName("_dwWriterID"); if (writerID != null && writerID.ElementType == ClrElementType.Int32) { int id = (int)writerID.GetValue(obj); if (id > 0) { ClrThread thread = GetThreadById(id); if (thread != null) { return(new DesktopBlockingObject(obj, true, 0, thread, BlockingReason.ReaderAcquired)); } } } ClrInstanceField uLock = type.GetFieldByName("_dwULockID"); ClrInstanceField lLock = type.GetFieldByName("_dwLLockID"); if (uLock != null && uLock.ElementType == ClrElementType.Int32 && lLock != null && lLock.ElementType == ClrElementType.Int32) { int uId = (int)uLock.GetValue(obj); int lId = (int)lLock.GetValue(obj); List <ClrThread> threads = null; foreach (ClrThread thread in _runtime.Threads) { foreach (IRWLockData l in _runtime.EnumerateLockData(thread.Address)) { if (l.LLockID == lId && l.ULockID == uId && l.Level > 0) { if (threads == null) { threads = new List <ClrThread>(); } threads.Add(thread); break; } } } if (threads != null) { return(new DesktopBlockingObject(obj, true, 0, BlockingReason.ReaderAcquired, threads.ToArray())); } } return(new DesktopBlockingObject(obj, false, 0, null, BlockingReason.None)); }