Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why has Visual Studio's Windows Forms Designer stopped working?

I'm in the process of cleaning up an old bit of C++-CLI software by decoupling business logic from the GUI. Despite the fact that I've left the windows forms designer code well alone, it now won't display my form and instead, throws an exception:

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

The call stack looks like this:

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) 

...none of which is my code. What might I have disturbed?

like image 983
Jon Cage Avatar asked Nov 26 '25 07:11

Jon Cage


1 Answers

Based on the call stack it looks like the WinForms designer is choking trying to read the code inside the InitializeComponents method in the generated file. The actual faulting party is the C++ code model implementation.

What's most likely happening here is a particular statement in the method is causing the code model to error here. I would start by commenting out the entire method, verifying that fixes the problem and then slowly uncommenting sections until I tracked down the offending line

like image 172
JaredPar Avatar answered Nov 28 '25 01:11

JaredPar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!