diff --git a/src/Microsoft.FeatureManagement/FeatureManager.cs b/src/Microsoft.FeatureManagement/FeatureManager.cs index 23599eb0..8ad9d40c 100644 --- a/src/Microsoft.FeatureManagement/FeatureManager.cs +++ b/src/Microsoft.FeatureManagement/FeatureManager.cs @@ -169,7 +169,7 @@ public async Task IsEnabledAsync(string feature, TContext appCon /// The name of the feature to check. /// The cancellation token to cancel the operation. /// True if the feature is enabled, otherwise false. - public async ValueTask IsEnabledAsync(string feature, CancellationToken cancellationToken) + public async ValueTask IsEnabledAsync(string feature, CancellationToken cancellationToken = default) { EvaluationEvent evaluationEvent = await EvaluateFeature(feature, context: null, useContext: false, cancellationToken); @@ -183,7 +183,7 @@ public async ValueTask IsEnabledAsync(string feature, CancellationToken ca /// A context providing information that can be used to evaluate whether a feature should be on or off. /// The cancellation token to cancel the operation. /// True if the feature is enabled, otherwise false. - public async ValueTask IsEnabledAsync(string feature, TContext appContext, CancellationToken cancellationToken) + public async ValueTask IsEnabledAsync(string feature, TContext appContext, CancellationToken cancellationToken = default) { EvaluationEvent evaluationEvent = await EvaluateFeature(feature, context: appContext, useContext: true, cancellationToken); @@ -203,7 +203,7 @@ public IAsyncEnumerable GetFeatureNamesAsync() /// Retrieves a list of feature names registered in the feature manager. /// /// An enumerator which provides asynchronous iteration over the feature names registered in the feature manager. - public async IAsyncEnumerable GetFeatureNamesAsync([EnumeratorCancellation] CancellationToken cancellationToken) + public async IAsyncEnumerable GetFeatureNamesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) { await foreach (FeatureDefinition featureDefinition in _featureDefinitionProvider.GetAllFeatureDefinitionsAsync().ConfigureAwait(false)) { @@ -219,7 +219,7 @@ public async IAsyncEnumerable GetFeatureNamesAsync([EnumeratorCancellati /// The name of the feature to evaluate. /// The cancellation token to cancel the operation. /// A variant assigned to the user based on the feature's configured allocation. - public async ValueTask GetVariantAsync(string feature, CancellationToken cancellationToken) + public async ValueTask GetVariantAsync(string feature, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(feature)) { @@ -238,7 +238,7 @@ public async ValueTask GetVariantAsync(string feature, CancellationToke /// An instance of used to evaluate which variant the user will be assigned. /// The cancellation token to cancel the operation. /// A variant assigned to the user based on the feature's configured allocation. - public async ValueTask GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken) + public async ValueTask GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(feature)) { diff --git a/src/Microsoft.FeatureManagement/IVariantFeatureManager.cs b/src/Microsoft.FeatureManagement/IVariantFeatureManager.cs index 8c7d2e84..bd8c665b 100644 --- a/src/Microsoft.FeatureManagement/IVariantFeatureManager.cs +++ b/src/Microsoft.FeatureManagement/IVariantFeatureManager.cs @@ -18,7 +18,7 @@ public interface IVariantFeatureManager /// /// The cancellation token to cancel the operation. /// An enumerator which provides asynchronous iteration over the feature names registered in the feature manager. - IAsyncEnumerable GetFeatureNamesAsync(CancellationToken cancellationToken); + IAsyncEnumerable GetFeatureNamesAsync(CancellationToken cancellationToken = default); /// /// Checks whether a given feature is enabled. @@ -26,7 +26,7 @@ public interface IVariantFeatureManager /// The name of the feature to check. /// The cancellation token to cancel the operation. /// True if the feature is enabled, otherwise false. - ValueTask IsEnabledAsync(string feature, CancellationToken cancellationToken); + ValueTask IsEnabledAsync(string feature, CancellationToken cancellationToken = default); /// /// Checks whether a given feature is enabled. @@ -35,7 +35,7 @@ public interface IVariantFeatureManager /// A context providing information that can be used to evaluate whether a feature should be on or off. /// The cancellation token to cancel the operation. /// True if the feature is enabled, otherwise false. - ValueTask IsEnabledAsync(string feature, TContext context, CancellationToken cancellationToken); + ValueTask IsEnabledAsync(string feature, TContext context, CancellationToken cancellationToken = default); /// /// Gets the assigned variant for a specific feature. @@ -43,7 +43,7 @@ public interface IVariantFeatureManager /// The name of the feature to evaluate. /// The cancellation token to cancel the operation. /// A variant assigned to the user based on the feature's configured allocation. - ValueTask GetVariantAsync(string feature, CancellationToken cancellationToken); + ValueTask GetVariantAsync(string feature, CancellationToken cancellationToken = default); /// /// Gets the assigned variant for a specific feature. @@ -52,6 +52,6 @@ public interface IVariantFeatureManager /// An instance of used to evaluate which variant the user will be assigned. /// The cancellation token to cancel the operation. /// A variant assigned to the user based on the feature's configured allocation. - ValueTask GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken); + ValueTask GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken = default); } }