DotNetAnalyzers/IDisposableAnalyzers

Exception when trying to run the fix to "Dispose before re-assigning."

JeremyMorton opened this issue · 0 comments

The code line with the issue:

          _goToAction = await GenerateActionAsync();
"Dispose before re-assigning." System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'Dispose before code gen failed for ExpressionStatement, write an issue so we can add support.')
  at IDisposableAnalyzers.DisposeBeforeAssignFix.DisposeBefore(DocumentEditor editor, ExpressionSyntax disposable, SyntaxNode location, CancellationToken cancellationToken)
  at IDisposableAnalyzers.DisposeBeforeAssignFix.DisposeBefore(DocumentEditor editor, ExpressionSyntax disposable, SyntaxNode location, CancellationToken cancellationToken)
  at Gu.Roslyn.CodeFixExtensions.DocumentEditorAction.GetChangedDocumentAsync(CancellationToken cancellationToken)
  at Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(CancellationToken cancellationToken) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Workspaces\Core\Portable\CodeActions\CodeAction.cs:line 212
  at Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(CancellationToken cancellationToken) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Workspaces\Core\Portable\CodeActions\CodeAction.cs:line 183
  at Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(IProgressTracker progressTracker, CancellationToken cancellationToken) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Workspaces\Core\Portable\CodeActions\CodeAction.cs:line 195
  at Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsCoreAsync(IProgressTracker progressTracker, CancellationToken cancellationToken) in Z:\BuildAgent\work\3b7ce003563d6f8f\src\Workspaces\Core\Portable\CodeActions\CodeAction.cs:line 153
  at JetBrains.Roslyn.Worker.Workspaces.Analyzers.CodeActionHelper.GetOperationsSafeAsync(CodeAction codeAction, CancellationToken cancellationToken)