From 99ee35a31c504e94eca0b172c0dcd962df827437 Mon Sep 17 00:00:00 2001 From: NextTurn <45985406+NextTurn@users.noreply.github.com> Date: Thu, 12 Dec 2019 00:00:00 +0800 Subject: [PATCH] Remove size checks to reduce 10 test failures --- .../src/DataReaders/Core/CoreDumpReader.cs | 4 ++-- .../src/DataReaders/DbgEng/DbgEngDataReader.cs | 4 ++-- .../src/DataReaders/Live/LiveDataReader.cs | 4 ++-- .../src/Linux/LinuxLiveDataReader.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Core/CoreDumpReader.cs b/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Core/CoreDumpReader.cs index 2024f830a..af6f92f82 100644 --- a/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Core/CoreDumpReader.cs +++ b/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Core/CoreDumpReader.cs @@ -159,7 +159,7 @@ public ulong ReadPointerUnsafe(ulong addr) public unsafe bool Read(ulong addr, out T value) where T : unmanaged { Span buffer = stackalloc byte[sizeof(T)]; - if (ReadMemory(addr, buffer, out int read) && read == sizeof(T)) + if (ReadMemory(addr, buffer, out int _)) { value = Unsafe.As(ref buffer[0]); return true; @@ -178,7 +178,7 @@ public T ReadUnsafe(ulong addr) where T : unmanaged public bool ReadPointer(ulong address, out ulong value) { Span buffer = stackalloc byte[IntPtr.Size]; - if (ReadMemory(address, buffer, out int read) && read == IntPtr.Size) + if (ReadMemory(address, buffer, out int _)) { value = buffer.AsPointer(); return true; diff --git a/src/Microsoft.Diagnostics.Runtime/src/DataReaders/DbgEng/DbgEngDataReader.cs b/src/Microsoft.Diagnostics.Runtime/src/DataReaders/DbgEng/DbgEngDataReader.cs index b315ae33d..f5a690f18 100644 --- a/src/Microsoft.Diagnostics.Runtime/src/DataReaders/DbgEng/DbgEngDataReader.cs +++ b/src/Microsoft.Diagnostics.Runtime/src/DataReaders/DbgEng/DbgEngDataReader.cs @@ -275,7 +275,7 @@ public ulong ReadPointerUnsafe(ulong addr) public unsafe bool Read(ulong addr, out T value) where T : unmanaged { Span buffer = stackalloc byte[sizeof(T)]; - if (ReadMemory(addr, buffer, out int read) && read == sizeof(T)) + if (ReadMemory(addr, buffer, out int _)) { value = Unsafe.As(ref buffer[0]); return true; @@ -294,7 +294,7 @@ public T ReadUnsafe(ulong addr) where T : unmanaged public bool ReadPointer(ulong address, out ulong value) { Span buffer = stackalloc byte[IntPtr.Size]; - if (ReadMemory(address, buffer, out int read) && read == IntPtr.Size) + if (ReadMemory(address, buffer, out int _)) { value = buffer.AsPointer(); return true; diff --git a/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Live/LiveDataReader.cs b/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Live/LiveDataReader.cs index 8ca00f25d..8bd184261 100644 --- a/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Live/LiveDataReader.cs +++ b/src/Microsoft.Diagnostics.Runtime/src/DataReaders/Live/LiveDataReader.cs @@ -194,7 +194,7 @@ public ulong ReadPointerUnsafe(ulong addr) public unsafe bool Read(ulong addr, out T value) where T : unmanaged { Span buffer = stackalloc byte[sizeof(T)]; - if (ReadMemory(addr, buffer, out int read) && read == sizeof(T)) + if (ReadMemory(addr, buffer, out int _)) { value = Unsafe.As(ref buffer[0]); return true; @@ -213,7 +213,7 @@ public T ReadUnsafe(ulong addr) where T : unmanaged public bool ReadPointer(ulong address, out ulong value) { Span buffer = stackalloc byte[IntPtr.Size]; - if (ReadMemory(address, buffer, out int read) && read == IntPtr.Size) + if (ReadMemory(address, buffer, out int _)) { value = buffer.AsPointer(); return true; diff --git a/src/Microsoft.Diagnostics.Runtime/src/Linux/LinuxLiveDataReader.cs b/src/Microsoft.Diagnostics.Runtime/src/Linux/LinuxLiveDataReader.cs index 09e067747..f3b3bb98e 100644 --- a/src/Microsoft.Diagnostics.Runtime/src/Linux/LinuxLiveDataReader.cs +++ b/src/Microsoft.Diagnostics.Runtime/src/Linux/LinuxLiveDataReader.cs @@ -181,7 +181,7 @@ public ulong ReadPointerUnsafe(ulong address) public unsafe bool Read(ulong addr, out T value) where T : unmanaged { Span buffer = stackalloc byte[sizeof(T)]; - if (ReadMemory(addr, buffer, out int read) && read == sizeof(T)) + if (ReadMemory(addr, buffer, out int _)) { value = Unsafe.As(ref buffer[0]); return true; @@ -200,7 +200,7 @@ public T ReadUnsafe(ulong addr) where T : unmanaged public bool ReadPointer(ulong address, out ulong value) { Span buffer = stackalloc byte[IntPtr.Size]; - if (ReadMemory(address, buffer, out int read) && read == IntPtr.Size) + if (ReadMemory(address, buffer, out int _)) { value = buffer.AsPointer(); return true;