-
Notifications
You must be signed in to change notification settings - Fork 154
Closed
Description
Bug description
An async method containing a synchronous local function doesn't trigger VSTHRD110 if that local function calls unawaited task methods.
Repro steps
async Task DoOperationAsync()
{
// Warning CS4014 as expected
HelperAsync();
DoOperationInner();
return;
void DoOperationInner()
{
// No warning, would expect VSTHRD110?
HelperAsync();
}
}
void DoOperation()
{
// Raises VSTHRD110 as expected
HelperAsync();
}
Task HelperAsync()
{
// e.g. some helper method doing some async work
return Task.CompletedTask;
}Expected behavior
A VSTHRD110 warning on the call to HelperAsync inside DoOperationInner
Actual behavior
No warning is raised
- Version used:
Microsoft.VisualStudio.Threading.Analyzers v17.12.19
Additional context
Thank you very much for the work you do on these analysers, they are super helpful at preventing issues in my code!
Cheers
Reactions are currently unavailable