Skip to content
Merged
Changes from 1 commit
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 is 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 is null)
Comment thread
zhiyuanliang-ms marked this conversation as resolved.
Resolved
{
throw new ArgumentNullException(nameof(appContext));
}

return (await EvaluateFeature(feature, context: appContext, useContext: true, cancellationToken).ConfigureAwait(false)).Enabled;
}

Expand Down
Loading