You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VSTHRD110 detects a GetAwaiter method is available from an extension method. However, the GetAwaiter method is not compatible with the actual result, so the code cannot be fixed.
TaskAwaiter<(T1, T2)> GetAwaiter<T1, T2>(this (Task<T1>, Task<T2>) tasks) is not compatible with (int,int).
using System.Runtime.CompilerServices;varstack=newStack<(int,int)>();
stack.Pop();// <-- VSTHRD110, but the result (int,int) cannot be awaited.internalstaticclassExtensions{publicstaticTaskAwaiter<(T1, T2)>GetAwaiter<T1,T2>(this(Task<T1>,Task<T2>)tasks){thrownew NotImplementedException();}}
dotnet build
=> Program.cs(4,1): warning VSTHRD110: Observe the awaitable result of this method call by awaiting it, assigning to a variable, or passing it to another method
Expected behavior
No diagnostic as there is no compatible GetAwaiter method to use await.
Actual behavior
VSTHRD110 is reported
Additional context
dotnet --info
.NET SDK:
Version: 7.0.200
Commit: 534117727b
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22623
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.200\
Host:
Version: 7.0.3
Architecture: x64
Commit: 0a2bda10e8
.NET SDKs installed:
7.0.103 [C:\Program Files\dotnet\sdk]
7.0.200 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
The text was updated successfully, but these errors were encountered:
Bug description
VSTHRD110 detects a
GetAwaiter
method is available from an extension method. However, theGetAwaiter
method is not compatible with the actual result, so the code cannot be fixed.TaskAwaiter<(T1, T2)> GetAwaiter<T1, T2>(this (Task<T1>, Task<T2>) tasks)
is not compatible with(int,int)
.Repro steps
dotnet new console
dotnet add package Microsoft.VisualStudio.Threading.Analyzers --version 17.5.22
Program.cs
with the following contentdotnet build
Program.cs(4,1): warning VSTHRD110: Observe the awaitable result of this method call by awaiting it, assigning to a variable, or passing it to another method
Expected behavior
No diagnostic as there is no compatible
GetAwaiter
method to useawait
.Actual behavior
VSTHRD110 is reported
Additional context
dotnet --info
The text was updated successfully, but these errors were encountered: