Skip to content

Add test for ApiConventionAnalyzer when passing null to Created#66437

Merged
Youssef1313 merged 1 commit intomainfrom
dev/ygerges/add-test
Apr 23, 2026
Merged

Add test for ApiConventionAnalyzer when passing null to Created#66437
Youssef1313 merged 1 commit intomainfrom
dev/ygerges/add-test

Conversation

@Youssef1313
Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 commented Apr 23, 2026

This PR adds a test for #35277

Closes #35277

Copilot AI review requested due to automatic review settings April 23, 2026 11:10
@Youssef1313 Youssef1313 requested a review from a team as a code owner April 23, 2026 11:10
@github-actions github-actions Bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Apr 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds regression coverage for issue #35277 to ensure ApiConventionAnalyzer does not crash when ControllerBase.Created(..., null) is used.

Changes:

  • Added an integration test that runs the analyzer on a controller action returning Created(uri, null) and asserts diagnostics are produced (indirectly also asserting no AD0001 analyzer crash).
  • Normalized file header encoding (BOM removal) in two files without functional changes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Mvc/Mvc.Api.Analyzers/test/ApiConventionAnalyzerIntegrationTest.cs Adds a new integration test covering Created(..., null) analyzer behavior/regression.
src/Mvc/Mvc.Api.Analyzers/src/SymbolApiResponseMetadataProvider.cs No functional change; header/encoding normalization only.

@Youssef1313 Youssef1313 enabled auto-merge (squash) April 23, 2026 11:29
@Youssef1313 Youssef1313 merged commit da92a97 into main Apr 23, 2026
31 checks passed
@Youssef1313 Youssef1313 deleted the dev/ygerges/add-test branch April 23, 2026 15:33
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview4 milestone Apr 23, 2026
@wtgodbe wtgodbe modified the milestones: 11.0-preview4, 11.0-preview5 Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null object on a Created response crashes the ApiConventionAnalyzer

3 participants