FantasticFiasco/mvvm-dialogs

ActivationException: Type not found in cache: MvvmDialogs.IDialogService.

kdotdk opened this issue · 9 comments

Hi

Adding MVVMDialogs to new MVVMLight WPF 451 project results in
ActivationException: Type not found in cache: MvvmDialogs.IDialogService.
in ViewModelLocator.Main line:
return ServiceLocator.Current.GetInstance();
when running the program.

Recreation:

  1. Create new MVVMLight project using MVVMLight project template WPF 451
  2. Add MVVMDialogs follwing the steps in README.md file
  3. Run the program.

Can you publish a minimal sample application here on GitHub displaying the problem and I can help you out. As you've already seen, there are numerous demo applications in this repository, all using MVVM Light. You can look at those to see if you figure out what is wrong with your application.

Almost minimal sample can be found here:
https://github.com/kdotdk/MVVMLightAndMVVMDialogs
First I pushed a clean MVVMLight app that compiles and run.
Second i pushed my try to add MVVMDialogs.
I have not been able to find the reason for the exception by compareing this ample with the demo projects.

I've created a PR in that repository, showing you how to configure the container.

Please note that the issue you've posted has nothing to do with MVVM Dialogs, but more on the subject on dependency injection and containers. If you feel you are lacking in that area, I propose this book. Although a bit dated, the concept of containers has not changed.

Having the same issue, and i'm using the same IOC as you, however your demo project work just fine.

Have you registered IDialogService in the container? Can you create a repo with an application that demonstrate the problem?

Yes i tried, but the class DialogService, has 2 constructors, so the container can't instantiate it.,

You have to tell the container how the service should be instantiated, as an example see one of the samples.

Cool, thanks for the support, it works

Np, only happy to contribute!