views:

252

answers:

3

In visual studio 2008 when open the design for a VB.Net windows form, i am getting the error " '.ctor' is not a valid identifier". I can see the form designer if I press the "Ignore and Continue" link.
All other forms are loading fine.

The callstack with the error message:

at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomEventBindingService.ValidateMethodName(String methodName)
at System.ComponentModel.Design.EventBindingService.EventPropertyDescriptor.SetValue(Object component, Object value)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAttachEventStatement(IDesignerSerializationManager manager, CodeAttachEventStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)

Any idea on how to fix this?

A: 

use vs2010 beta2 instead....

jj
I'm not going to downvote this (yet) since you may have some rationale for this suggestion (if so, it would be nice if you could include it with the answer). Some people shy away from (or flat out aren't allowed to use) beta products, especially in corporate environments.
paxdiablo
A: 

This message may indicate that you accidently have overwritten the constructor. As far as I know, M$ VStudio instanciates your form to display it in the designer window.

Maybe the following steps will help

  • Check, if you have a Sub with your class name defined in your .vb-file (for example: "Private Sub YOURCLASS (...) Handles MyBase.Load" instead of "Private Sub YOURCLASS_load (...) Handles MyBase.Load" )
  • go into the Solution Explorer (nice name, isn't it)
  • rebuild the whole solution

Best regards

Michael Preiss
Forgot to tell: if the check in the first step succeeds and you really find such a sub, then rename it
Michael Preiss
It's called MS.
Rhapsody
A: 

A very simple solution would be rebuilding the form from scratch and that probably won't give an error. The Visual Studio designer sometimes create code the designer itself won't understand.

Some other steps to make sure you're not watching an old designer dll file.

Close the designer for the file Clean the project and rebuild Start the application Open the designer

This should force the designer to reload the file.

The designer also seems to block all network traffic, if you do anything with remoting/webservices it probably won't work and cause unexpected error while designing.

Barfieldmv