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
I observed an analyzer failure in my build log following some changes that a colleague had committed to a codebase. In the committed code, there were some esoteric but syntactically valid await statements such as:
When trying to analyze the above statement the following analyzer failure was observed, caused by the parentheses around the expression that is being awaited:
warning AD0001: Analyzer 'Microsoft.VisualStudio.Threading.Analyzers.VSTHRD003UseJtfRunAsyncAnalyzer' threw an exception of type 'System.Exception' with message 'Analyzer failure while processing syntax at C:\Redacted\SomeFile.cs(XXX,YY):
System.InvalidCastException Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax'..
Syntax: await (queryClient.GetTagRecord(name, cancellationToken).ConfigureAwait(false))'.
Repro steps
Add an await statement to a program that encloses the asynchronous operation in parentheses, as shown above.
Expected behavior
Since the syntax is valid, the analyzer should accommodate this without throwing an error.
Actual behavior
The analyzer failed because of an assumption about the type of expression it had encountered.
Version used: 16.9.60
Application (if applicable): VS 2019 16.9.6
Additional context
The syntax used is unusual, and is very easy to fix in the offending code, so this is very much on the "very minor annoyance" end of the severity scale!
The text was updated successfully, but these errors were encountered:
Bug description
I observed an analyzer failure in my build log following some changes that a colleague had committed to a codebase. In the committed code, there were some esoteric but syntactically valid
await
statements such as:When trying to analyze the above statement the following analyzer failure was observed, caused by the parentheses around the expression that is being awaited:
Repro steps
Add an
await
statement to a program that encloses the asynchronous operation in parentheses, as shown above.Expected behavior
Since the syntax is valid, the analyzer should accommodate this without throwing an error.
Actual behavior
The analyzer failed because of an assumption about the type of expression it had encountered.
Additional context
The syntax used is unusual, and is very easy to fix in the offending code, so this is very much on the "very minor annoyance" end of the severity scale!
The text was updated successfully, but these errors were encountered: