I have a legacy WPF application that’s been converted to .NET 8. Everything works great, except the singletons we have in the app, which will not transfer easily to a Blazor Server App. I was able to spin up a Blazor App with the preexisting libraries and utilize Fluxor to manage state. And this works great.
However, in the WPF app, I am unable to get Fluxor to inject things like IState. It is always null in constructors. Both the Blazor Server & WPF apps need to use the same Fluxor State management now.
In my WPF App.xaml.cs:
var coll = new ServiceCollection();
coll.AddFluxor(o => o.ScanAssemblies(typeof(ModelState).Assembly));
var store = (IStore)ServiceCollectionExtension.Resolve(coll, typeof(Store));
store.InitializeAsync().Wait();
coll.AddScoped<IPricingService, PricingService>();
public class PricingService : IPricingService
{
public PricingService(IDispatcher dispatcher, IState<PricingState> pricingState...
_dispatcher = dispatcher;
_pricingState = pricingState;
pricingState is always null, since I cannot register my IState with the normal Microsoft.Extensions.DependencyInjection.ServiceCollection
Note, the IDispatcher seems to inject fine.