Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleInjectorControllerActivator incorrectly reports calling deprecated RegisterMvcControllers method #802

Closed
dotnetjunkie opened this issue Feb 24, 2020 · 3 comments
Labels
Milestone

Comments

@dotnetjunkie
Copy link
Collaborator

@dotnetjunkie dotnetjunkie commented Feb 24, 2020

In case an ASP.NET Core controller is resolved by SimpleInjectorControllerActivator, while it isn't registered explicitly in Simple Injector, an exception is thrown with the following message:

For the {0} to function properly, it requires all controllers to be registered explicitly in Simple Injector, but a registration for {1} is missing. To ensure all controllers are registered properly, call the RegisterMvcControllers extension method on the Container from within your Startup.Configure method while supplying the IApplicationBuilder instance, e.g. "this.container.RegisterMvcControllers(app);".

The RegisterMvcControllers(this Container) extension method, however, is deprecated. The exception message should, therefore, point to the correct method to call, which is the AddControllerActivation(this SimpleInjectorAspNetCoreBuilder) extension method.

@dotnetjunkie dotnetjunkie added the bug label Feb 24, 2020
@dotnetjunkie dotnetjunkie added this to the v4.9.1 milestone Feb 24, 2020
@dotnetjunkie

This comment has been minimized.

Copy link
Collaborator Author

@dotnetjunkie dotnetjunkie commented Feb 24, 2020

It might also be the case that the user actually called the correct methods, but the resolved controller was not part of the registered application parts. MVC application parts are added using the AddApplicationPart(Assembly) method. So there might actually be some more room for improvement of this message.

@dotnetjunkie

This comment has been minimized.

Copy link
Collaborator Author

@dotnetjunkie dotnetjunkie commented Mar 3, 2020

bug-802 branch created.

@dotnetjunkie

This comment has been minimized.

Copy link
Collaborator Author

@dotnetjunkie dotnetjunkie commented Mar 6, 2020

This bug has been fixed in v4.9.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.