How to debug Visual Studio 2012 instance design-ti

2019-02-06 09:25发布

I'm developing a WPF MarkupExtension and encountered errors during design time. With the previous version of Visual Studio 2010 it was possible to start a second instance of Visual Studio 2010 and attach to the process of the already-running instance, setting breakpoints and debugging the design time behavior.

In Visual Studio 2012 however I can attach to the process of another Visual Studio 2012 as well, but no symbols are loaded in the second instance and therefor I'm not able to debug the design time as with Visual Studio 2010.

How do I get this debugger running?

Things I've tried:

  • "devenv.exe /RootSuffix Exp" trick without success
  • Always execute as Administrator
  • Load all or default symbols
  • Debug with and without native code (attach process)
  • Debug with and without .NET 4 code (attach process)

3条回答
家丑人穷心不美
2楼-- · 2019-02-06 09:42

Make sure you have the "Enable/Disable Project Code" toggle set to "enabled"...in VS/Blend 2015 it's a small icon below the XAML editor as shown here.

If it's disabled, this could be the reason your design time instance doesn't seem to be working.

Further, if it's disabled and you attempt to debug using a second VS instance, then when you attach to the XDesProc any breakpoints you set in the code-behind will report that they "will not currently be hit. [because] No symbols have been loaded for this document". You might think that you need to somehow load the symbols, but if you open up the Modules window attempting to do so, you won't even see your module in the listing.

I lost a couple hours on this issue because of this setting being disabled. Hope this helps others not do the same. Because of that, I'll post this on a few of the related questions.

BTW, there's an excellent description of this debugging procedure by James McNellis on one of those related questions.

查看更多
Viruses.
3楼-- · 2019-02-06 09:50

The process is called XDesProc, and it is created with each new Preview Window. Therefor: to debug a preview window, open a second instance of Visual Studio 2012 with the same solution, set your breakpoints and attach to XDesProc. It's recommended to have only one preview window open to attach to the right process. Otherwise use Process Explorer to find the correct process.

查看更多
Ridiculous、
4楼-- · 2019-02-06 10:00

In Visual Studio 2012, the WPF designer runs in a separate process. Try fiddling with that process. It should be easy to find out the process name.

查看更多
登录 后发表回答