Skip to content

Conversation

Alex-Sob
Copy link

@Alex-Sob Alex-Sob commented Sep 11, 2025

This PR should fix #56831

Changes

  • In RouteHandlerAnalyzer null-forgiving operator is used incorrectly on parameterTypeSymbol variable because parameterTypeSymbol may be null. For example, it is null in the case when parameterSymbol.Type is a generic type parameter. Fixed this by just replacing it with null-conditional operator.

  • Added [StringSyntax] attribute in CSharpAnalyzerVerifier<TAnalyzer>.VerifyAnalyzerAsync to enable syntax highlighting for test source code. I actually decided to suggest a separate PR for that [Proposal] Analyzer test readability improvements #63642

  • Added a unit test.

@github-actions github-actions bot added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Sep 11, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 11, 2025
Copy link
Contributor

Hey @dotnet/aspnet-build, looks like this PR is something you want to take a look at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning AD0001 : Analyzer 'Microsoft.AspNetCore.Analyzers.RouteHandlers.RouteHandlerAnalyzer' NullReferenceException due to generics in minimal API
1 participant