当我构建应用程序时,我有一个控件在表单设计器上崩溃,并试图弄清楚如何调试问题。
我认为要能够使用调试器,我需要做的就是启动 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 是解决方案的一部分,由项目引用,其中包含表单和自定义控件。
当我关闭消息框时,控件会在我的表单上显示控件的堆栈跟踪,但由于它不包含行号,我不知道问题出在哪里。