8000 Do not call 'IServiceCollection.BuildServiceProvider' in 'ConfigureServices' · Issue #187 · ExtCore/ExtCore · GitHub
[go: up one dir, main page]

Skip to content

Do not call 'IServiceCollection.BuildServiceProvider' in 'ConfigureServices' #187

@andersjarl

Description

@andersjarl

Hi!

When doing call in ConfigureServices:

services.AddExtCore(this.extensionsPath, false, new ExtCore.WebApplication.DefaultAssemblyProvider(services.BuildServiceProvider())

You will get the following warning:
warning ASP0000: Calling 'BuildServiceProvider' from application code results in an additional copy of singleton services being created. Consider alternatives such as dependency injecting services as parameters to 'Configure'.

Is this something you are going to address?
It is not recommended to use BuildServiceProvider inside ConfigureServices but the constructor of DefaultAssemblyProvider expects to get a ServiceProvider.

Regards
Anders

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0