From 065ae1e8b397fd3162d5d1918643019721bf70c3 Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Mon, 28 Oct 2024 19:48:03 +1100 Subject: [PATCH] Suppress CA2022 warnings in VB code These warnings are helpful in general. They flag apparently incorrect use of `Stream.Read`, where the return value is unused. In the abstract, reading from a stream into a buffer is not guaranteed to return all the bytes requested, as those bytes may not yet be available. The cases covered by these three diagnostics are all in very old VB code, which hasn't been touched in ~15 years. My investigation suggests that all usages operate on `MemoryStream` which will actually always return the bytes you request. I feel it's less risky to just suppress these warnings rather than trying to fix them. --- src/Microsoft.VisualStudio.Editors/GlobalSuppressions.vb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.VisualStudio.Editors/GlobalSuppressions.vb b/src/Microsoft.VisualStudio.Editors/GlobalSuppressions.vb index dc904a527a..b94689760a 100644 --- a/src/Microsoft.VisualStudio.Editors/GlobalSuppressions.vb +++ b/src/Microsoft.VisualStudio.Editors/GlobalSuppressions.vb @@ -1295,3 +1295,6 @@ Imports System.Diagnostics.CodeAnalysis ' Bugs + + +