Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/sdk/server-side-sdks/dotnet/dotnet-openfeature.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Initialize the DevCycle SDK and set the DevCycleProvider as the provider for Ope
```csharp
// Both Cloud, and Local are supported by the OpenFeature Provider. This example uses the Cloud Provider for sake of brevity in the configuration.
var devCycleClient = new DevCycleCloudClientBuilder().SetEnvironmentKey(SDK_ENV_VAR).SetLogger(new NullLoggerFactory()).Build();
OpenFeature.Api.Instance.SetProvider(devCycleClient.GetOpenFeatureProvider());
await OpenFeature.Api.Instance.SetProviderAsync(devCycleClient.GetOpenFeatureProvider());

FeatureClient oFeatureClient = OpenFeature.Api.Instance.GetClient();
// The evaluation context is an example of a fully populated DevCycleUser. The only required value is a bucketing key of `user_id` or `targetingKey`
Expand All @@ -93,6 +93,10 @@ EvaluationContext ctx = EvaluationContext.Builder()
```
[//]: # 'wizard-initialize-end'

`SetProviderAsync` waits for the provider to finish initializing before it returns. For Local Bucketing, this includes waiting for the initial configuration to download before you evaluate a flag.

Keep this initialization path asynchronous. Do not block on the returned task with `.Wait()`, `.Result`, or `.GetAwaiter().GetResult()`. Blocking can deadlock applications that use a UI or legacy ASP.NET synchronization context.

### Evaluate a Variable
Use a Variable value by passing the Variable key, default value, and EvaluationContext to one of the OpenFeature flag evaluation methods

Expand Down
Loading