Using Windows 7 and Visual Studio 2010, I am writing a C# custom UserControl. I was coding in code view for weeks and recently when I tried to switch to design mode, Visual Studio hanged, "NOT RESPONDING". I can wait for an hour, and still nothing happens. Clicking on the close button it gives the "Do you want to wait, close, restart and send information to Microsoft" dialog.
Is there a way to (stack)trace the code that the designer is trying to execute? Maybe design-time trace messages or breakpoints?
For Visual Studio 2010, this answer does the job .
For Visual Studio 2012 or above, what you need to do is actually debug the Visual Studio Designer process. The process you want to debug is called XDesProc.exe
.
I do the following:
If you missed it, or need to restart the steps, start again from step (2) 'Close all windows' killing XDesProc instances. Sometimes the designer starts up once and caches values, and you will need to have a clean, non-exception designer to track down the problem.
You can debug the Visual Studio designer itself! Open a second instance of Visual Studio, use the Tools -> Attach To Process
and attach to the first Visual Studio (ie devenv.exe
).
In Visual Studio instance #2 (the one that you did the Attach To Process in) : Put a breakpoint on your usercontrol's constructor
In Visual Studio instance #1 (the original one, that will get stuck) : Open the designer which your usercontrol is in, the breakpoint in VS#2 will get hit.
The process you want to debug is XDesProc.exe
- see Dr. ABT's answer . Otherwise the procedure is as for Visual Studio 2010/2013.
答案在演练:在设计时调试自定义Windows窗体控件 (MSDN)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.