From 14bc3745d09faa6578f964064b454c6e469af863 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 2 Sep 2026 08:20:35 -0600 Subject: [PATCH] Fix incorrect ValueTask doc comment on VSTHRD114 analyzer Audited all analyzers for issue #414 (ValueTask support). Found: - VSTHRD111 (ConfigureAwait): already handles ValueTask explicitly. - VSTHRD011, VSTHRD109, VSTHRD200: use HasAsyncCompatibleReturnType/IsAsyncCompatibleReturnType, which already recognize ValueTask via its AsyncMethodBuilderAttribute. - VSTHRD110, VSTHRD200 Remove-suffix check: use AwaitableTypeTester, which discovers any type with a GetAwaiter method, including ValueTask. - VSTHRD012, VSTHRD108, VSTHRD001, VSTHRD004, VSTHRD100, VSTHRD106, VSTHRD116/117: not Task-type-specific; no gap. - VSTHRD114 (avoid returning null Task): its doc comment incorrectly claimed ValueTask support, but ValueTask/ValueTask are value types so \ eturn null;\ is a compile error (CS0037) and can never reach this analyzer. Corrected the doc comment to explain this instead of implying non-existent support. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../AbstractVSTHRD114AvoidReturningNullTaskAnalyzer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.VisualStudio.Threading.Analyzers/AbstractVSTHRD114AvoidReturningNullTaskAnalyzer.cs b/src/Microsoft.VisualStudio.Threading.Analyzers/AbstractVSTHRD114AvoidReturningNullTaskAnalyzer.cs index b677d1bfe..9e81c7c41 100644 --- a/src/Microsoft.VisualStudio.Threading.Analyzers/AbstractVSTHRD114AvoidReturningNullTaskAnalyzer.cs +++ b/src/Microsoft.VisualStudio.Threading.Analyzers/AbstractVSTHRD114AvoidReturningNullTaskAnalyzer.cs @@ -10,9 +10,12 @@ namespace Microsoft.VisualStudio.Threading.Analyzers; /// -/// Finds await expressions on that do not use . -/// Also works on . +/// Finds methods that return in place of a or . /// +/// +/// and are value types, so cannot be +/// returned in their place and the compiler already prevents this pattern for them. +/// public abstract class AbstractVSTHRD114AvoidReturningNullTaskAnalyzer : DiagnosticAnalyzer { public const string Id = "VSTHRD114";