0

I'm on Prism Unity 8.1.97 with VS2022 and net6.0-windows project.

In my App.xaml.cs I registered a dialog like this inside RegisterTypes():

containerRegistry.RegisterDialog<MyDialog, MyViewModel>();

When the application tries to show the dialog like this:

_dialogService.ShowDialog("MyDialog", parameters, r => { });

I can see the following Debug output in Visual Studio but the debugger doesn't break so I get no info on the exception:

Exception thrown: 'Prism.Ioc.ContainerResolutionException' in Prism.Unity.Wpf.dll

I tried this in App.xaml.cs to get more info on the exception but the event handler doesn't seem to execute. Dialogs aren't modules?

While debugging the application, I can do the following and it returns a not null object:

_iocContainer.Resolve<object>("MyDialog")

How can I get access to the ContainerResolutionException details?

Why isn't this working anyway?

teegee
  • 63
  • 9
  • `debugger doesn't break` - not even with a break point in `r => { }`? – Haukinger Mar 18 '22 at 08:28
  • No. I put a breakpoint on the ShowDialog() call one afterwards and one inside the callback. If I step over ShowDialog() it never returns. And it doesn't break inside the callback either – teegee Mar 18 '22 at 08:45
  • I should probably mention that the same application can show 2 other dialogs that are registered in the same way with no issues – teegee Mar 18 '22 at 08:49
  • Looks like I ended up a the non-UI thread. I can launch the dialog from elsewhere. Didn't think I had to be in the UI thread to run the ShowDialog() method – teegee Mar 18 '22 at 09:25
  • 1
    What I disagree with is for prism to throw a ContainerResolutionException. That was very misleading – teegee Mar 19 '22 at 04:21

0 Answers0