Giter VIP home page Giter VIP logo

Comments (8)

davidstarkcab avatar davidstarkcab commented on August 28, 2024 1

@zhiyuanliang-ms Yes, now it works perfectly! Many thanks!

from featuremanagement-dotnet.

zhiyuanliang-ms avatar zhiyuanliang-ms commented on August 28, 2024 1

Microsoft.FeatureManagement 3.3.1 has been released.

from featuremanagement-dotnet.

jimmyca15 avatar jimmyca15 commented on August 28, 2024

What version did you upgrade from, and is the same setup working with the old version?

from featuremanagement-dotnet.

zhiyuanliang-ms avatar zhiyuanliang-ms commented on August 28, 2024

Hi, @davidstarkcab

I have reproduced the bug. This bug is introduced by 3.3.0. Sorry for the inconvenience.

The reason of this bug is that in v3.3.0, we enhance the TimeWindowFilter to support recurrence settings. To optimize the recurring time window evaluation, we used a memory cache in TimeWindowFilter, which cause the registeration of TimeWindowFilter is slightly different from other built-in filters. We used a new overload of AddFeatureFilter method. This caused TimeWindowFilter being registered multiple times and the feature manager will get duplicated filter metadata of it. Then, AmbiguousFeatureFilter exception is thrown.

To resolve your problem, please downgrade to 3.2.0 or you can change this line

builder.Services.AddFeatureManagement().AddFeatureFilter<ContextualTargetingFilter>().AddFeatureFilter<TimeWindowFilter>().AddFeatureFilter<PercentageFilter>();

to

builder.Services.AddFeatureManagement();

Starting from 3.0.0, ContextualTargetingFilter, TimeWindowFilter and PercentageFilter are registered within the AddFeatureManagement call. For more details, see here
So you no longer need to register them by yourself. We mention this in the public doc and also in the README.

In the README, we said

There a few feature filters that come with the Microsoft.FeatureManagement package: PercentageFilter, TimeWindowFilter, ContextualTargetingFilter and TargetingFilter. All filters, except for the TargetingFilter, are added automatically when feature management is registered.

This is a mistake, I should bold this to catch more eyes. I will update the README and fix the bug soon.

from featuremanagement-dotnet.

davidstarkcab avatar davidstarkcab commented on August 28, 2024

What version did you upgrade from, and is the same setup working with the old version?

3.2.0 and its the same setup

from featuremanagement-dotnet.

davidstarkcab avatar davidstarkcab commented on August 28, 2024

@zhiyuanliang-ms Thanks!

from featuremanagement-dotnet.

zhiyuanliang-ms avatar zhiyuanliang-ms commented on August 28, 2024

@jimmyca15

Our previous way to avoid duplicated registeration is to check the implementationType of existing ServiceDescriptor in the service collection.
Now, time window filter is registered through implementationFactory, its descriptor's implementationType is null.

ServiceDescriptor doesn't allow us to set implementationType while using implementationFactory.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.servicedescriptor?view=net-6.0

I didn't come up a graceful solution. Currently, I have two was in my mind:

  1. Breaking change (We may adopt this in v4)

Remove the public Cache property of TimeWindowFilter and put it into the constructor
Remove the overload of AddFeatureFilter(Func)

  1. Work around

Ignore TimeWindowFilter in AddFeatureFilter()

The FeatureManagementBuilder is internal, so our implementation of AddFeatureFilter() will only be called after calling AddFeatureManagement() where the TimeWindowFilter should have been registered

from featuremanagement-dotnet.

zhiyuanliang-ms avatar zhiyuanliang-ms commented on August 28, 2024

Hi, @davidstarkcab

Have you tried removing all AddFeatureFilter calls to register built-in feature filters? Did it work for you?

from featuremanagement-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.