views:

81

answers:

2

I have a Managed C++ WinForm that suddenly stopped showing in the VS 2005 designer. The error it shows is

Could not find type 'int'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.

I don't even know where to start with this one. Does the designer only access the InitializeComponent(void) method when rendering the form? So my question is: where do you start troubleshooting designer errors?

EDIT: I forgot to mention that this code builds and runs perfectly. It only shows an error in the windows forms designer.

A: 

This is usually caused by a syntax error somewhere in the code that causes the designer to be unable to run the form to render it. The best method for this is ofent sadly just reading the code looking for the problem extra brace, missing string etc. The good news is that it is most likely easy to find since you know that it preceeds the INT in the error message.

Some possibilities: * I cause this usually by accidentally hitting the keybaord and putting some extra characters at the top of a file * Extra braces that make the class uncompilable - missing quotes, semicolons * Something typed at the top that messes up a common include/using statement

Diagnostics * Sometimes you can find this by dogin a build and seeing what lione is flagged with an error and then looking around it. * More often then not I have to just open the source file and scan through it looking for the problem.

Marcus Erickson
+1  A: 

This is troubleshooting for C# but I'd assume a couple of the points mentioned here would help.

http://stackoverflow.com/questions/49458/whats-the-state-of-play-with-visual-inheritance#49526

Quibblesome
This issue resolved itself as abruptly as it occurred and I can only assume it was due to a clean build or a restart as stated in the best answer from the link above. Thanks!
brian