Fluxor Blazor error on assembly scanning and registration

468 views Asked by At

I've followed the steps of setting up a Fluxor library.

Added var currentAssembly = typeof(Program).Assembly; builder.Services.AddFluxor(options => options.ScanAssemblies(currentAssembly));

into the Program.cs. Then added <Fluxor.Blazor.Web.StoreInitializer/> into App.Razor

Stater is decorated with [FeatureState] attribute. Everything according to documention. But the application fails to start with the message :

ArgumentException: An item with the same key has already been added. Key: Store.Account.AccountTopUpState

Seems like the problem exists in Fluxor assembly scanning ...

1

There are 1 answers

1
Eric King On

Are you also creating a class deriving from Feature<AccountTopUpState>? If so, remove the [FeatureState] attribute. I believe the attribute was added as an alternative to the Feature base class approach, and you should choose one approach or the other, but not both.