Clarify assembly requirements for AddValidation() in .NET 10 Minimal APIs - #37419
Open
wadepickett with Copilot wants to merge 9 commits into
Open
Clarify assembly requirements for AddValidation() in .NET 10 Minimal APIs#37419wadepickett with Copilot wants to merge 9 commits into
wadepickett with Copilot wants to merge 9 commits into
Conversation
Open
4 tasks
Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Clarify source-generator assembly requirements for AddValidation in .NET 10
Clarify assembly requirements for AddValidation() in .NET 10 Minimal APIs
Aug 5, 2026
gumbarros
reviewed
Aug 5, 2026
wadepickett
reviewed
Aug 5, 2026
wadepickett
reviewed
Aug 5, 2026
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Per reviewer sugestion: Updated namespace references for service collection extensions and usage in the Program file.
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
wadepickett
reviewed
Aug 5, 2026
Co-authored-by: Wade Pickett <wpickett@microsoft.com>
Added section on customizing validation error responses using IProblemDetailsService.
wadepickett
marked this pull request as ready for review
August 5, 2026 02:04
wadepickett
approved these changes
Aug 5, 2026
Contributor
There was a problem hiding this comment.
Approved (after changes were made).
2nd Reviewer approval still required. @gumbarros does this look OK to you? Publish?
Yes, perfect. |
gumbarros
approved these changes
Aug 5, 2026
Contributor
|
Sorry @gumbarros, I accidently sent a review request after you provided one. Please ignore. My I didn't notice my page had not refreshed. Thanks very much for writing up the issue, your suggestions and providing reviews!!! |
tdykstra
approved these changes
Aug 5, 2026
Co-authored-by: Tom Dykstra <tdykstra@microsoft.com>
Co-authored-by: Tom Dykstra <tdykstra@microsoft.com>
gumbarros
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AddValidation()uses a compile-time source generator that only discovers validatable types in the assembly where it's called. When endpoints live in a referenced assembly butAddValidation()is registered in the host, validation silently doesn't run—invalid payloads return200 OKinstead of400 Bad Request. The docs didn't call this out.Changes
aspnetcore/fundamentals/minimal-apis.md[!NOTE]on the source-generator/assembly constraint.ms.date.aspnetcore/release-notes/aspnetcore-10/includes/ValidationSupportMinAPI.md— Added a short[!NOTE]cross-referencing the new section.Workaround documented
Register
AddValidation()from within the endpoints' assembly, then call it from the host:Guidance mirrors the existing Blazor "Use validation models from a different assembly" precedent.
Internal previews