-
-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Labels
Description
As originally reported by @chuuddo, they have provided unit tests to help produce the exception here:
master...chuuddo:rxui_initialization_breaks_simpleinjector_resolver
Details of their explanation:
SimpleInjectorDependencyResolver not works in real apps.
I made a pull request #239 with changes to View and ViewModel classes to start initialization of RxApp and all tests fails.
After some investigations i found this issues:
- The container is locked after the first call to resolve but ReactiveUI invoke all registrations after RxApp.EnsureInitialized(). This can be fixed by not getting instace of MainWindow from container. If there are no other solutions, we should add this workaround to documentation.
//var window = (MainWindow)container.GetInstance<IViewFor<MainViewModel>>();
var window = new MainWindow();
window.ViewModel = container.GetInstance<MainViewModel>();
window.Show();
- SimpleInjector support multiple registrations for same interface only through Collection.Register. We can't register this lines using _container.Register() method.
_container.Register(serviceType, factory); |
I don't have any workarounds for second issue. Can we use this DI container with ReactiveUI?
Originally posted by @chuuddo in #233 (comment)
chuuddo