Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Failed to parse method 'InitializeComponent' error after upgrade from 2003 to 2005
 

Failed to parse method 'InitializeComponent' error after upgrade from 2003 to 2005

After converting a solution with lots of forms, user controls and resource files from 2003 to 2005 I get the following error when trying to view a form in the designer:

Failed to parse method 'InitializeComponent'. The parser reported the following error 'Error HRESULT E_FAIL has been returned from a call to a COM component.'. Please look in the Task List for potential errors.

at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.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)

When I look in InitializeComponent I see thatproperties that should beset to anempty string are being changed to reference a projectresource file (not the form resource) that happens to have an entry with an empty value. The error occurs because it assumes that there is a generated class for the resx files but since it was created in 2003 there isn't.

If I run the code generator for the resource file then the code will compile but you still end up with forms referencing a resource file that has nothing to do with the form.

Is there any way to stop the form designer code generator from replacing all the empty string properties with a call to an unrelated resource file?

henderjj  Wednesday, June 13, 2007 10:34 AM

Did you ever get a reply or solve this problem? I got this error on a website created from scratch in VS 2008 for the .Net 3.5 framework.

WR

WhiskeyRomeo  Tuesday, March 25, 2008 4:27 PM

For the record I have now suffered the same crash when upgrading? to VS2008 from 2005. (March/08)

A search on 'InitializeComponent' reveals that EVERY form in the project has the same code block instead of just one.

As there is no post with any suggestion for recovery I guess I have to recreate every form in the app.

You gotta love it Smile

Al

alp99  Wednesday, March 26, 2008 10:08 PM
http://www.programmersheaven.com/mb/VB_Beginner/364226/364226/vbnet-copy--paste-form-problem/?S=B20000
check this out.
After making copy/paste, just replace the name of the class (find the line starting with me.name= ... ) in the two files formname.vb and formname.Designer.vb .
luiza.s  Friday, May 01, 2009 8:27 PM

You can use google to search for other answers

Custom Search

More Threads

• What is the maximum width of a button ?
• Form resized by IDE
• Cross - Threading in .Net 2005
• DynamicProperties
• MainMenu and MenuItem controls
• How can I add my custom control the DataSource properties
• How can i add a verb to a components designer from a different components designer
• VS2005 Beta 2 form designer problem: error while parsing EntityName
• Re ordering the columns in datagridview
• Is it possible....?