Skip to content

[WIP] Add IServiceCollectionValidator for DI validation#128246

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-isc-collection-validator
Draft

[WIP] Add IServiceCollectionValidator for DI validation#128246
Copilot wants to merge 3 commits into
mainfrom
copilot/add-isc-collection-validator

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

  • Create ValidationResult readonly struct in Abstractions package
  • Create IServiceCollectionValidator interface in Abstractions package
  • Create ServiceCollectionValidationExtensions in Abstractions package (with generic, instance, and delegate overloads)
  • Integrate validator execution into BuildServiceProvider in main DI package
  • Add error message string resource to main DI package
  • Update Abstractions ref file with new public API surface
  • Add tests to ServiceProviderValidationTests.cs
  • Build verified - both libraries build cleanly
  • All 1380 tests pass (including 11 new validator tests)

…rviceProvider

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/7f9fbc0f-fc3d-49a0-827c-b36f71b15b48

Co-authored-by: rosebyte <14963300+rosebyte@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 15, 2026 08:56
Copilot AI requested review from Copilot and removed request for Copilot May 15, 2026 09:10
Copilot stopped work on behalf of rosebyte due to an error May 15, 2026 09:19
Copilot AI requested a review from rosebyte May 15, 2026 09:19
/// <summary>
/// Represents the result of an <see cref="IServiceCollectionValidator"/> validation.
/// </summary>
public readonly struct ValidationResult
Copy link
Copy Markdown
Member

@tarekgh tarekgh May 15, 2026

Choose a reason for hiding this comment

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

Is it ok to use the same type name ValidationResult which already used in the data annotations?

https://source.dot.net/#System.ComponentModel.Annotations/System/ComponentModel/DataAnnotations/ValidationResult.cs,15

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-extensions-dependencyinjection
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add IServiceCollectionValidator for optional DI validation at BuildServiceProvider

3 participants