【发布时间】:2011-04-13 09:37:13
【问题描述】:
当我构建应用程序时,我有一个控件在表单设计器上崩溃,我正在尝试找出如何调试问题。
我认为能够使用调试器所需要做的就是启动 VS 的第二个副本并使用 Debug-Attach 来处理并附加到 Visual Studio 的副本,我的麻烦控制的解决方案是我这样做了,但是当控件崩溃时什么都没有发生,所以我知道我做错了什么......
在设计器中发生崩溃并返回消息框:
---------------------------
Microsoft Visual Studio
---------------------------
The control NameSpace.MyControl has thrown an unhandled exception in the designer and has been disabled.
Exception:
Could not load file or assembly 'OtherProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Stack trace:
at NameSpace.MyControl.OnPaint(PaintEventArgs e)
---------------------------
OK
---------------------------
OtherProject 是解决方案的一部分,由包含表单和自定义控件的项目引用。
当我关闭消息框时,控件会在我的表单上显示控件所在的堆栈跟踪,但由于它不包含行号,我不知道问题出在哪里。
【问题讨论】:
-
崩溃是什么意思?整个 Visual Studio 是否会直接消失而没有任何错误消息?或者当您尝试打开表单时是否看到错误消息?当设计人员无法实例化控件并且通常您会在错误消息中获得非常有用的信息时,就会发生这种情况。如果有消息,请在此处发布。
-
OtherProject是您解决方案中的一个项目吗?它编译了吗?
标签: debugging visual-studio-2010 designer designmode