Skip to content

Commit

Permalink
Fix analyzer RCS1246 (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored May 8, 2024
1 parent 5d86d80 commit 1556d11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix analyzer [RCS1246](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1246) ([PR](https://github.com/dotnet/roslynator/pull/1460))

## [4.12.2] - 2024-04-23

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions src/Common/CSharp/Analysis/UseElementAccessAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public static bool IsFixableLast(
if (((CSharpCompilation)semanticModel.Compilation).LanguageVersion < LanguageVersion.CSharp8)
return false;

if (semanticModel.Compilation.GetTypeByMetadataName("System.Index") is null)
return false;

IMethodSymbol methodSymbol = semanticModel.GetReducedExtensionMethodInfo(invocationInfo.InvocationExpression, cancellationToken).Symbol;

if (methodSymbol is null)
Expand Down

0 comments on commit 1556d11

Please sign in to comment.