Skip to content

AddSingleton does not work as expected #1111

@TedyHH

Description

@TedyHH

Describe the bug
When we register tool like AddSingleton(type, instance) and pass a singleton instance, it seems that the instance is being ignored and the library creates a new instance when it needs it.
I tried also AddSingleton using a factory method like this:
services.AddSingleton(toolType, provider => Activator.CreateInstance(toolType, this.m_compositionService));
A breakpoint to Activator.CreateInstance was never hit and the tool just created the instance of the tool.

To Reproduce
Steps to reproduce the behavior:
1.

Expected behavior
A clear and concise description of what you expected to happen.

Logs
If applicable, add logs to help explain your problem.

Additional context
We discussed the issue over email. Please feel free to contact me there if you need additional information. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions