visual-studio - 为什么 Visual Studio 的 Windows 窗体设计器停止工作?

标签 visual-studio visual-studio-2008 c++-cli windows-forms-designer

我正在通过将业务逻辑与 GUI 分离来清理旧的 C++-CLI 软件。尽管我已经将 Windows 窗体设计器代码单独保留,但它现在不会显示我的窗体,而是抛出异常:

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) 

调用堆栈如下所示:

at EnvDTE.CodeFunction.GetStartPoint(vsCMPart Part)
at Microsoft.VisualC.CppCodeParser.OnMethodPopulateStatements(Object sender, EventArgs e)
at System.CodeDom.CodeMemberMethod.get_Statements()
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) 

...其中没有一个是我的代码。我可能打扰了什么?

最佳答案

根据调用堆栈,WinForms 设计器似乎在尝试读取生成文件中的 InitializeComponents 方法内的代码时感到窒息。真正的错误方是C++代码模型的实现。

这里最有可能发生的是方法中的特定语句导致代码模型在此处出错。我会首先注释掉整个方法,验证是否解决了问题,然后慢慢取消注释部分,直到找到有问题的行

关于visual-studio - 为什么 Visual Studio 的 Windows 窗体设计器停止工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15768131/

相关文章:

visual-studio-2008 - Visual Studio 2008 弃用方法

c# - catch 中是否支持通用异常?

c++ - 如何在 Windows XP 上安装 GDI+ 1.1 版?

c# - 当 T 正在实现类时,C++/CLI 中的 IComparable<T>

.net - 在 C++/CLI 中创建具有空维度大小的多维数组

c - 在 Visual Studio 中编写 C 代码

c - 如何使用 cl 编译 Window API 程序?

visual-studio - Visual Studio : missing Shortcut: "Visual Studio Command Prompt"

.net - 如何优雅地关闭另一个应用程序?

visual-studio - 在 Visual Studio 中显示未删节的测试参数输入值