Skip to content

System.ArgumentOutOfRangeException: 'end' must not be less than 'start' in CSharpStructureHelpers.cs:286 #62506

@KirillOsenkov

Description

@KirillOsenkov

Version Used:
Roslyn that shipped in VS 17.2.5

In this line:

var hintTextEndToken = GetHintTextEndToken(node);

hintTextEndToken is default (for node internal record PdbFilePathResult(string PdbFilePath);), so hintSpan: TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End) is getting passed the startPosition and 0, which results in this exception when invoking Go To Definition on an interface defined in metadata, for which we have source link.

System.ArgumentOutOfRangeException: 'end' must not be less than 'start'
Parameter name: end
   at Microsoft.CodeAnalysis.Text.TextSpan.FromBounds(Int32 start, Int32 end) in C:\Roslyn\src\Compilers\Core\Portable\Text\TextSpan.cs:line 194
 Microsoft.CodeAnalysisTextSpan.FromBounds Line 194
 Microsoft.CodeAnalysis.CSharp.FeaturesCSharpStructureHelpers.<CollectCommentBlockSpans>g__TryGetLeadingCollapsibleSpan|12_0 Line 287
 Microsoft.CodeAnalysis.CSharp.FeaturesCSharpStructureHelpers.CollectCommentBlockSpans Line 254
 Microsoft.CodeAnalysis.CSharp.FeaturesTypeDeclarationStructureProvider.CollectBlockSpans Line 26
 Microsoft.CodeAnalysis.FeaturesAbstractSyntaxNodeStructureProvider`1.CollectBlockSpans Line 34
 Microsoft.CodeAnalysis.FeaturesBlockSpanCollector.GetBlockSpans Line 66
 Microsoft.CodeAnalysis.FeaturesBlockSpanCollector.Collect Line 56
 Microsoft.CodeAnalysis.FeaturesBlockSpanCollector.CollectBlockSpans Line 41
 Microsoft.CodeAnalysis.FeaturesAbstractBlockStructureProvider.ProvideBlockStructure Line 42
 Microsoft.CodeAnalysis.FeaturesBlockStructureServiceWithProviders.GetBlockStructure Line 80
 Microsoft.CodeAnalysis.FeaturesBlockStructureServiceWithProviders.<GetBlockStructureAsync>d__5.MoveNext Line 56

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions