diff --git a/Directory.Packages.props b/Directory.Packages.props index f1845702895..36a006caaf8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -54,7 +54,7 @@ - + diff --git a/src/Platform/Microsoft.Testing.Platform/IPC/Serializers/BaseSerializer.cs b/src/Platform/Microsoft.Testing.Platform/IPC/Serializers/BaseSerializer.cs index ee10295eae0..58473362103 100644 --- a/src/Platform/Microsoft.Testing.Platform/IPC/Serializers/BaseSerializer.cs +++ b/src/Platform/Microsoft.Testing.Platform/IPC/Serializers/BaseSerializer.cs @@ -18,20 +18,12 @@ internal abstract class BaseSerializer protected static string ReadString(Stream stream) { Span len = stackalloc byte[sizeof(int)]; -#if NET7_0_OR_GREATER stream.ReadExactly(len); -#else - _ = stream.Read(len); -#endif int stringLen = BitConverter.ToInt32(len); byte[] bytes = ArrayPool.Shared.Rent(stringLen); try { -#if NET7_0_OR_GREATER stream.ReadExactly(bytes, 0, stringLen); -#else - _ = stream.Read(bytes, 0, stringLen); -#endif return Encoding.UTF8.GetString(bytes, 0, stringLen); } finally @@ -45,11 +37,7 @@ protected static string ReadStringValue(Stream stream, int size) byte[] bytes = ArrayPool.Shared.Rent(size); try { -#if NET7_0_OR_GREATER stream.ReadExactly(bytes, 0, size); -#else - _ = stream.Read(bytes, 0, size); -#endif return Encoding.UTF8.GetString(bytes, 0, size); } finally @@ -148,44 +136,28 @@ protected static void WriteBool(Stream stream, bool value) protected static int ReadInt(Stream stream) { Span bytes = stackalloc byte[sizeof(int)]; -#if NET7_0_OR_GREATER stream.ReadExactly(bytes); -#else - _ = stream.Read(bytes); -#endif return BitConverter.ToInt32(bytes); } protected static long ReadLong(Stream stream) { Span bytes = stackalloc byte[sizeof(long)]; -#if NET7_0_OR_GREATER stream.ReadExactly(bytes); -#else - _ = stream.Read(bytes); -#endif return BitConverter.ToInt64(bytes); } protected static ushort ReadShort(Stream stream) { Span bytes = stackalloc byte[sizeof(ushort)]; -#if NET7_0_OR_GREATER stream.ReadExactly(bytes); -#else - _ = stream.Read(bytes); -#endif return BitConverter.ToUInt16(bytes); } protected static bool ReadBool(Stream stream) { Span bytes = stackalloc byte[sizeof(bool)]; -#if NET7_0_OR_GREATER stream.ReadExactly(bytes); -#else - _ = stream.Read(bytes); -#endif return BitConverter.ToBoolean(bytes); }