CA1849 triggers when using nameof of a Task property in an async method #6993
Labels
Area-Microsoft.CodeAnalysis.NetAnalyzers
Bug
The product is not behaving according to its current intended design
False_Positive
A diagnostic is reported for non-problematic case
good first issue
help wanted
The issue is up-for-grabs, and can be claimed by commenting
Milestone
Analyzer
Diagnostic ID: CA1849:
Call async methods when in an async method
Analyzer source
NuGet Package: microsoft.entityframeworkcore.analyzers
Version: 7.0.12 (latest)
Describe the bug
The following expression triggers a warning when used in an async method
nameof(Task<object>.Result)
For instance:
Expected behavior
Since it's a nameof(), it shouldn't trigger the warning.
Actual behavior
It triggers a warning:
Warning CA1849 'Task.Result' synchronously blocks. Use await instead.
The text was updated successfully, but these errors were encountered: