Skip to content

Commit e4141f8

Browse files
authored
Disable CA2022 error (#9174)
* Disable CA2022 error * Replace Stream.Read with Stream.ReadExactly * Removing fall-back for below NET7.0
1 parent 4d7beb6 commit e4141f8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/InkSerializedFormat/DrawingAttributeSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ internal static uint DecodeAsISF(Stream stream, GuidList guidList, uint maximumS
189189
}
190190

191191
byte[] data = new byte[ropSize];
192-
stream.Read (data, 0, (int)ropSize);
192+
stream.ReadExactly(data);
193193

194194
if (data != null && data.Length > 0)
195195
{

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/dataobject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@ private int GetDataIntoOleStructsByTypeMedimIStream(string format, object data,
15861586

15871587
byte[] buffer = new byte[NativeMethods.IntPtrToInt32(size)];
15881588
inkStream.Position = 0;
1589-
inkStream.Read(buffer, 0, NativeMethods.IntPtrToInt32(size));
1589+
inkStream.ReadExactly(buffer);
15901590

15911591
istream.Write(buffer, NativeMethods.IntPtrToInt32(size), IntPtr.Zero);
15921592
hr = NativeMethods.S_OK;
@@ -1725,7 +1725,7 @@ private int SaveStreamToHandle(IntPtr handle, Stream stream, bool doNotReallocat
17251725

17261726
bytes = new byte[NativeMethods.IntPtrToInt32(size)];
17271727
stream.Position = 0;
1728-
stream.Read(bytes, 0, NativeMethods.IntPtrToInt32(size));
1728+
stream.ReadExactly(bytes);
17291729
Marshal.Copy(bytes, 0, ptr, NativeMethods.IntPtrToInt32(size));
17301730
}
17311731
finally

0 commit comments

Comments
 (0)