ArgumentOutOfRangeException in SyntaxNode.FindNode
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
I'm using the bits from 17.11.0.
Various analyzers have an `ArgumentOutOfRangeException` with the same pattern here:
https://github.com/dotnet/roslyn/blob/139f8454c7a9aca7807fe98bb760c3705559b902/src/Compilers/Core/Portable/Syntax/SyntaxNode.cs#L962-L967
`FullSpan` is contained inside `span`:

Sample stack:
Microsoft.CodeAnalysis SyntaxNode.FindNode Line 966
Microsoft.CodeAnalysis.Workspaces SyntaxNodeExtensions.FindNode Line 786
Microsoft.CodeAnalysis.Workspaces AnalysisContextExtensions.GetAnalysisRoot Line 217
Microsoft.CodeAnalysis.Features SimplifyTypeNamesDiagnosticAnalyzerBase`2.AnalyzerImpl.AnalyzeCodeBlock Line 247
`context.CodeBlock` is a subspan of `context.FilterSpan` here:
https://github.com/dotnet/roslyn/blob/139f8454c7a9aca7807fe98bb760c3705559b902/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/AnalysisContextExtensions.cs#L216-L217

@mavasani this is pretty noisy. Just from a cursory search:
* https://github.com/dotnet/roslyn/issues/74773
* https://github.com/dotnet/roslyn/issues/74772
* https://github.com/dotnet/roslyn/issues/67932
In my case the repro was to hover over here:
https://github.com/KirillOsenkov/MSBuildStructuredLog/blob/5e5f5f68741eb550a27c9cf1084a02dcaf914619/src/StructuredLogger/Strings/Strings.cs#L620
Contributor guide
Assessment
This issue has not been assessed yet.