Skip to content

Conversation

@josephwoodward
Copy link
Contributor

No description provided.

@jimmyca15
Copy link
Member

@zhenlan thoughts on changing the default behavior to throw on a missing feature? I would prefer that we do it that way. It is a breaking behavioral change, but not a breaking API change. Therefore it wouldn't require a major version bump.

@jimmyca15
Copy link
Member

Discussed with @zhenlan, let's go ahead and make the default behavior to not throw for a missing feature. There is a scenario for this where a developer codes ahead of someone who is setting up configuration.

@josephwoodward
Copy link
Contributor Author

@jimmyca15 Thanks for the clarification, I'll update the PR.

@josephwoodward josephwoodward force-pushed the IgnoreMissingFeaturesSwitch branch from d2aca88 to 822825f Compare June 28, 2020 18:23
@josephwoodward josephwoodward marked this pull request as ready for review June 28, 2020 18:23
@josephwoodward
Copy link
Contributor Author

@jimmyca15 Updated following your comments and now ready for review.

/// Controls the behavior of feature evaluation when the specified feature does not exist.
/// If missing features are not ignored, an exception will be thrown when attempting to evaluate them.
/// </summary>
public bool IgnoreMissingFeatures { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want this defaults to true.

services
.Configure<FeatureManagementOptions>(options =>
{
options.IgnoreMissingFeatures = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this so we can test the default behavior and ensure no regressions.

services
.Configure<FeatureManagementOptions>(options =>
{
options.IgnoreMissingFeatures = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed?

using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I may miss it as it's not very easy to tell. What we are using in the reflection namespace?

else if (!_options.IgnoreMissingFeatures)
{
throw new FeatureManagementException(FeatureManagementError.MissingFeature, $"The feature declaration for specified feature '{feature}' was not found.");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should log a warning even if IgnoreMissingFeatures is true. Suggest change below

else
{
    string errorMessage = $"The feature declaration for specified feature '{feature}' was not found.";
    if (!_options.IgnoreMissingFeatures)
    {
        throw new FeatureManagementException(FeatureManagementError.MissingFeature, errorMessage);
    }
    else
    {
        _logger.LogWarning(errorMessage);
    }
}

@microsoft-github-updates microsoft-github-updates bot changed the base branch from master to main September 22, 2020 22:48
@jimmyca15
Copy link
Member

jimmyca15 commented Sep 1, 2021

This PR has not had any recent activity. In an effort to address #68, a new PR, #140, has been created. Any future discussion can be moved there.

@jimmyca15 jimmyca15 closed this Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants