private static byte[] ReadBuffer(ClrHeap heap, ulong address, int length) { byte[] buffer = new byte[length]; int byteRead = heap.ReadMemory(address, buffer, 0, buffer.Length); if (byteRead != length) throw new InvalidOperationException(string.Format("Expected to read {0} bytes and actually read {1}", length, byteRead)); return buffer; }