8000 LaunchDarkly.ClientSDK does not allow multiple instances · Issue #92 · launchdarkly/dotnet-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

LaunchDarkly.ClientSDK does not allow multiple instances #92

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

Open
dlprows opened this issue Apr 17, 2025 · 1 comment
Open

LaunchDarkly.ClientSDK does not allow multiple instances #92

dlprows opened this issue Apr 17, 2025 · 1 comment
Labels

Comments

@dlprows
Copy link
dlprows commented Apr 17, 2025

Is your feature request related to a problem? Please describe.
LaunchDarkly.ClientSDK does not allow for multiple instances to be able to connect to multiple environments or get flags from multiple projects

Describe the solution you'd like
I would like to be able to instantiate multiple LDClient instances.

The LdClient.CreateInstance method specifically throws an exception if you try to instantiate multiple instances
https://github.com/launchdarkly/dotnet-core/blob/main/pkgs/sdk/client/src/LdClient.cs#L624

At a glance, it looks like there are no static properties that would cause complications if you could just instantiate multiple instances.

The only problem appears to be because of the built in singleton pattern, but if there were public methods to instantiate a non-singleton instance, then it would be pretty clear to the user that they were intentionally creating an instance that won't be accessible from the built in singleton pattern

Describe alternatives you've considered
there may be some hacky reflection to bypass the Init/CreateInstance methods and call the constructor directly. But that would be error prone

Additional context

@tanderson-ld tanderson-ld added the enhancement New feature or request label Apr 22, 2025
@tanderson-ld
Copy link
Contributor

Thank you @dlprows for taking the time to write this feature request. We are moving in the direction of all SDKs supporting N many instantiations and moving away from the singleton pattern. I will make sure we have this request logged in our backlog.

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

No branches or pull requests

2 participants
0