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...
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...
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.
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.
Here are another two cents. Just make sure that the Options->Debugging->General->Enable Just My Code is unchecked in the instance you are using to attach to the designer's process.
I found both answers useful. Just adding my 2 cents - In the VS copy that you're using to attach to the designer, I needed to select the code type manually (Managed, v4.0 in my example) in the Attach To Process dialog to get the desired result. For some reason the default for devenv was Script, T-SQL. Looking at the date of the OP and original answers, it may be that an update to VS caused this change... just speculating.