Debugging with the MVVM Light Toolkit

Mar 23, 2010 at 4:59 PM

Hello all,

 

I'm a neebie in .Net and MVVM pattern.

I have some difficulties to debug my application in visual studio 2008. Each time I get an exception in my model classes at runtime, this exception is hidden by a global exception from the ViewModelLocator.

Does anybody have a solution to solve this problem and get the original exception throw by the application ? Or maybe it is an error due to a mistake in my "cut and paste" ....

 

I'm waiting for your answers ^^

 

Guillaume.

Mar 23, 2010 at 5:07 PM
Edited Mar 23, 2010 at 5:07 PM

Hi,

sounds like you are not breaking on all exceptions.

Maybe try to enable them as described here:
http://msdn.microsoft.com/en-us/library/d14azbfh%28VS.80%29.aspx

Cheers,
Hinnerk

Mar 23, 2010 at 5:45 PM

Yeah !!!!

Thanks for your help, exceptions are breaking my debugger correctly now...

But I don't understand why I need this extra configuration for an MVVM application ...

Thanks for your help ;)

Coordinator
Mar 23, 2010 at 6:33 PM

Hi,

This is not a MVVM issue, but rather a WPF or Silverlight issue. Exceptions thrown when parsing the XAML code are not thrown explicitly unless you enable this setting. This is actually to prevent what is called first chance exceptions, exception that are handled internally, to be thrown and to worsen your development experience.

WHen you have an exception caused by the XAML parser, you can use the Exception Details link to dig into the internal exceptions that actually caused the error in the first place.

Hopefully this makes sense,

Laurent

Mar 25, 2010 at 10:34 AM

Thanks for your explanations Laurent.

It's pleasant to really understand what happens in some cases like this one ...