reactiveui/Sextant

[BUG] When calling Locator.CurrentMutable.RegisterNotificationView get exception

albilaga opened this issue · 7 comments

Describe the bug
When calling Locator.CurrentMutable.RegisterNotificationView get exception Sextant.ViewModelFactoryNotFoundException: Could not find a default ViewModelFactory. This should never happen, your dependency resolver is broken

Steps To Reproduce

  1. Update Sextant.XamForms to 2.8.1 or 2.9.1
  2. Run apps.
  3. It will throw exception

Expected behavior
No exception appear and app running as usual

Additional context
Only happened on Sextant.XamForms v2.8.1 or 2.9.1. Right now using Sextant.XamForms 2.7.1 and looks like it is working fine.

Thanks for reporting this. I'll look at it today. Are you only using the Sextant.XamForms package? What does your registration look like? It may have been missed in the Sextant.InitializeForms method.

This how I register sextant

Locator
                .CurrentMutable
                .RegisterNavigationView(() =>
                    new NavigationView(RxApp.MainThreadScheduler, RxApp.TaskpoolScheduler, ViewLocator.Current))
                .RegisterParameterViewStackService()
                .RegisterView<LoginPage, LoginViewModel>();

And I still got the same exception using v 2.9.4 and yes I am only using Sextant.XamForms package installed on .net standard project only (where views located).

Should I call Sextant.InitializeForms? But I don't see it in readme and it looks fine on v2.7.1?

@albilaga Adding the same fix for this PR to your registration doesn't resolve the problem? There is a new dependency you need to register in order for everything to continue working. It may not be added to the README.

Sextant.Initialize is marked Obsolete. We prefer you construct what is needed using extensions. The

Sextant.IntializeForms method will most likely be removed in the future in place of an extension method to handle it.

Locator.CurrentMutable.RegisterViewModelFactory();

Realase 2.8.1 introduced a fix that we tried to put in to maintain backward compatibility, which obviously isn't working.

If it's causing user issues might be worth removing those methods and doing a major bump

If we need Sextant.Initialize or Sextant.InitializeForms I think we need to upgrade the version to v3 and update the readme to make it important? Because right now I don't see the required Sextant.InitializeForms in the readme and in v2.7.1 I can use Sextant without using that method.

Part of having release pages is to let people know of new things that are coming and potential changes to help identify regressions.

While the README doesn't state it. The Sample Application uses it.

#240 introduced this issue. I fixed what was the most obvious place. The next PR should fix the problem. I just want to put together a proper reproduction so I can verify the fix.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.