Skip to content

IntroduceVariableCodeRefactoringProvider throws ArgumentOutOfRangeException when highlighting whitespace between attribute arguments #28665

@davkean

Description

@davkean
  1. Replace the $$$$ with whitespace, and highlight the same location with mouse
public partial class AbstractEvaluationCommandLineHandlerTests
{
    [InlineData("A.cs;B.cs;C.cs",     $$$$     "B.cs;C.cs", "D.cs;E.cs", @"C:\Project\A.cs;C:\Project\D.cs;C:\Project\E.cs")]
    public void ApplyEvaluationChanges_WithExistingDesignTimeChanges_CanRenameItem(string currentFiles, string originalNames, string newNames, string expected)
    {
    }
}
System.ArgumentOutOfRangeException : 'end' must not be less than 'start'
Parameter name: end
   at Microsoft.CodeAnalysis.Text.TextSpan.FromBounds(Int32 start,Int32 end)
   at Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6.State.GetExpressionUnderSpan(SyntaxTree tree,TextSpan textSpan,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6.State.TryInitialize(TextSpan textSpan,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6.State.Generate(TService service,SemanticDocument document,TextSpan textSpan,CancellationToken cancellationToken)
   at async Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6.IntroduceVariableAsync[TService,TExpressionSyntax,TTypeSyntax,TTypeDeclarationSyntax,TQueryExpressionSyntax,TNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeRefactorings.IntroduceVariable.IntroduceVariableCodeRefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Metadata

Metadata

Assignees

Labels

Area-IDEBugDeveloper CommunityThe issue was originally reported on https://developercommunity.visualstudio.comResolution-FixedThe bug has been fixed and/or the requested behavior has been implemented

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions