views:

36

answers:

2

Is there a way to debug Visual Studio or Blend so I can figure out where XAML designer load errors come from in my code?

The stack traces are often useless.

Thanks...

A: 

Use two VS2010 instances. Load one with your main app probject or a test harness application project and load the other with your controls project. Having built the controls project reference the debug dlls in your other project. Debugging from the VS2010 instance holding the controls project attach to the VS2010 instance holding the test application.

Place your break points as you like.

Now drive the test application instance of VS2010 as you would when building yout controls into an application, when your controls are load their code will execute and you can start stepping the code. You can do a similar thing when working with your controls in Blend just attach to the Blend instance.

AnthonyWJones
A: 

In VS, first go to Debug->Exceptions and check the box for "Thrown" for CLR Exceptions. This will break into the debugger for exceptions caught by the Blend/VS app. Then do Debug->Attach To Process... and find the instance of Blend or devenv that has your solution open. Once the debugger starts up you can open the XAML file in the designer and debug against it.

John Bowen
I've tried this a few different ways - the debugger never "catches" an exception.
chadbr