Skip to content

Mvc unable to resolve controllers not registered as services #27

@TheJayMann

Description

@TheJayMann

I am not sure if this is by design or not (the getting started and sample MVC application appear to suggest that it might not be), but when attempting to get one of my existing MVC projects ported over from a different dependency injection service to instead use this one, I was unable to get controllers to work with dependency injection unless I had added the controllers as services themselves. It appears this is due to the Mvc package having no path to ActivatorUtilities.CreateInstance (or, in this case, ActivatorUtilities.CreateFactory). It is only called by RequiredObjectFactoryFactory, which itself is only used when calling GetRequiredService, where Mvc only calls TryGetService.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions