Skip to content

Bug: Should not use Async methods in analyzers (CC0029) #821

@giggio

Description

@giggio

Right now only DisposablesShouldCallSuppressFinalizeAnalyzer, for VB, is doing that.
See:
https://github.com/code-cracker/code-cracker/blob/master/src/VisualBasic/CodeCracker/Usage/DisposablesShouldCallSuppressFinalizeAnalyzer.vb#L38

This line: https://github.com/code-cracker/code-cracker/blob/master/src/VisualBasic/CodeCracker/Usage/DisposablesShouldCallSuppressFinalizeAnalyzer.vb#L51
Has to change from:

Dim syntaxTree = Await disposeMethod.DeclaringSyntaxReferences(0)?.GetSyntaxAsync(context.CancellationToken)

to:

Dim syntaxTree = disposeMethod.DeclaringSyntaxReferences(0)?.GetSyntax(context.CancellationToken)

And the method should not be async anymore.

More info: dotnet/roslyn#13140

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions