Skip to content

Allow Simple Injector to return the complete list of validation errors #1029

Description

@dotnetjunkie

When calling Container.Verify() only the first error is always returns. While this is fine for most scenario's, e.g. when the user forgot to register an interface, it is very useful to see all errors especially when the code is being refactored.

There are possible ways to do this:

  1. Add an Container.Verify(bool showAllErrors) overload
  2. Add a property to the exception thrown by Container.Verify() that contains the full list of errors, and append text to the exception message stating something like "You are only shown the first error. To see the full list of validation errors, please inspect the ValidationErrors property."

I decided to let Verify() throw a new exception type VerificationException, rather than InvalidOperationException, as this allows all the errors to be wrapped. But throwing a different exception is a breaking change.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions