Form visible at runtime, but not at design time
c#, visual-studio-2010, windows-forms-designer, winforms
Solution
I remember I saw this before. According to this it might be a compilation issue (too many brackets) which happens in VS2008 and won't surprise me if it happens in VS2010 too.
Problem
My project has no errors, I'm able to run it via F5, but I can't look at my "main" form, as the [Design] tab tells me, "To prevent possible data loss before loading the designer, the following errors must be resolved: The class name "?" is not a valid identifier for this language." But the Error List that contains that Description says it's at Line 0 and Column 0. Build | Clean Solution did not help. The Call Stack from the [Design] page is: ``` at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.CodeTypeDeclarationFromCodeClass(CodeClass vsClass) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnNamespacePopulateTypes(Object sender, EventArgs e) at System.CodeDom.CodeNamespace.get_Types() at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.Parse(TextReader codeStream) at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.System.CodeDom.Compiler.ICodeParser.Parse(TextReader stream) at System.CodeDom.Compiler.CodeDomProvider.Parse(TextReader codeStream) at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit() at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) ``` UPDATE A shutdown of VS2010 and restart solved it. Here: http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(WHYDTELPAGE)%3bk(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV4.0%22)&rd=true I found a few suggestions, including this one (but I didn't need to try it, as making VS go to its room for a minute or two before coming back out worked): "delete the [solutionname].suo file which contains designer layout info from your previous session, then start the project and rebuild.."