diff --git a/src/Microsoft.FeatureManagement/FeatureManager.cs b/src/Microsoft.FeatureManagement/FeatureManager.cs index 91605ecb..f7bca84a 100644 --- a/src/Microsoft.FeatureManagement/FeatureManager.cs +++ b/src/Microsoft.FeatureManagement/FeatureManager.cs @@ -155,6 +155,11 @@ public async Task IsEnabledAsync(string feature) /// True if the feature is enabled, otherwise false. public async Task IsEnabledAsync(string feature, TContext appContext) { + if (appContext == null) + { + throw new ArgumentNullException(nameof(appContext)); + } + return (await EvaluateFeature(feature, context: appContext, useContext: true, CancellationToken.None).ConfigureAwait(false)).Enabled; } @@ -178,6 +183,11 @@ public async ValueTask IsEnabledAsync(string feature, CancellationToken ca /// True if the feature is enabled, otherwise false. public async ValueTask IsEnabledAsync(string feature, TContext appContext, CancellationToken cancellationToken = default) { + if (appContext == null) + { + throw new ArgumentNullException(nameof(appContext)); + } + return (await EvaluateFeature(feature, context: appContext, useContext: true, cancellationToken).ConfigureAwait(false)).Enabled; }