2

I am facing exceptions when opening the Visual Studio Designer.

You can find the complete stack trace here.

I already asked a question where I explained that the crash occurred when passing from XAML to Designer.

An answer suggested to debug the designer with a second instance of Visual Studio.

I've tried the following :

  • Open a second instance of Visual Studio, attach the devenv.exe process, put a breakpoint on InitializeComponent (which is called by the constructor of my RadWindow).
  • Go to the first instance of Visual Studio, open the designer.

Nothing happened (i.e. the breakpoint isn't reached). Do you have any idea of how can I perform the debug ?

Thank you in advance.

Community
  • 1
  • 1
Chostakovitch
  • 965
  • 1
  • 9
  • 33

1 Answers1

3

Your approach is almost correct. However the process that manages design time WPF rendering varies from Visual Studio version:

Visual Studio 2010 -> devenv.exe.
Visual Studio 2012+ -> XDesProc.exe.
Visual Studio 2022 -> WpfSurface.exe.

Approach:

  1. Open second Visual Studio with same solution.

  2. Set breakpoints in second VS.

  3. Build solution (in either VS).

  4. VS2012 and above:
    Some caching occurs that will prevent hitting beakpoints, so to circumvent, end all running WPF render processes via Windows Task Manager.

  5. (VS2012 and above):
    To restart the render process, open any xaml document (not the one you wish to debug) in the first VS instance. A new render process starts!

  6. In second VS instance, attach to the newly started render process (XDesProc.exe / devenv.exe / WpfSurface.exe)

  7. Open xaml document you wish to debug in first VS.

  8. Breakpoint hit!

Note: breakpoints should be red to show that they are active. If they are not, then the files used by the debugger does not match the build . If so, stop debugging, end the render process, rebuild and try again.

Anders
  • 1,590
  • 1
  • 20
  • 37
  • Thank you for your answer. I don't have any `XDesProc.exe` process running, even when the Designer is opened. – Chostakovitch Apr 27 '15 at 07:47
  • Oh, didn't see you are using VS2010. In VS2013 it is XDesProc. Just a moment, and i'll correct for VS2010. – Anders Apr 27 '15 at 07:49
  • Sorry, But i've uninstalled VS2010 a little while ago, so need to install again, to be able to help. For VS2010 it should be the same procedure, except you attach to `devnev.exe` instead of `XDesProc.exe`. Try closing all open designer files, rebuilding, attaching, and then open file. It is a known question here in the forum: [How to troubleshoot and debug Visual Studio design mode errors?](http://stackoverflow.com/questions/13698388/how-to-troubleshoot-and-debug-visual-studio-design-mode-errors/13698442#13698442) – Anders Apr 27 '15 at 07:52
  • I did the exact process, and it does nothing. Am I missing something ? I put the breakpoint at the beginning of my `RadWindow` constructor. – Chostakovitch Apr 27 '15 at 08:15
  • It is red. I found an answer which solves the problem of breakpoints, but not the identification of the component : http://stackoverflow.com/a/29890506/4384927 – Chostakovitch Apr 27 '15 at 08:49
  • I have done all of this many times. My Breakpoints dont become red. I Use Vs 2017. Is there an other way ? – sven Feb 01 '18 at 13:43