Skip to content
Open
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
10 changes: 10 additions & 0 deletions src/Microsoft.FeatureManagement/FeatureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ public async Task<bool> IsEnabledAsync(string feature)
/// <returns>True if the feature is enabled, otherwise false.</returns>
public async Task<bool> IsEnabledAsync<TContext>(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;
}

Expand All @@ -178,6 +183,11 @@ public async ValueTask<bool> IsEnabledAsync(string feature, CancellationToken ca
/// <returns>True if the feature is enabled, otherwise false.</returns>
public async ValueTask<bool> IsEnabledAsync<TContext>(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;
}

Expand Down
Loading