chrisbray
asked on
How can I fix a 'Path is not of a legal form' error
I have a base form from which I inherit frequently in a large solution (currenty 33 projects!) and for some time now it has been throwing an error on a laptop, but fine on on my main machine. Now, it has started the same error on the main machine too and has brought development to a halt :-(
The symptoms are that none of the inheriting forms will open in the designer, although all are fine at runtime. The designer fails to load the form, giving a typically opaque and stupid error message that only Microsoft could think would be acceptable: The path is not of a legal form. Not what path, or where, or anything about it other than it is not in the form it wants!
The full error message is:
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.
The path is not of a legal form.
Hide
at System.Signature._GetSigna ture(Signa tureStruct & signature, Void* pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr declaringTypeHandle)
at System.Signature.GetSignat ure(Signat ureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandle fieldHandle, RuntimeMethodHandle methodHandle, RuntimeTypeHandle declaringTypeHandle)
at System.Signature..ctor(Run timeMethod Handle methodHandle, RuntimeTypeHandle declaringTypeHandle)
at System.Reflection.RuntimeM ethodInfo. get_Signat ure()
at System.Reflection.RuntimeM ethodInfo. GetParamet ersNoCopy( )
at System.Reflection.RuntimeP ropertyInf o.GetIndex Parameters ()
at System.ComponentModel.Refl ectTypeDes criptionPr ovider.Ref lectGetPro perties(Ty pe type)
at System.ComponentModel.Refl ectTypeDes criptionPr ovider.Ref lectedType Data.GetPr operties()
at System.ComponentModel.Type Descriptor .TypeDescr iptionNode .DefaultTy peDescript or.System. ComponentM odel.ICust omTypeDesc riptor.Get Properties ()
at System.ComponentModel.Type Descriptor .TypeDescr iptionNode .DefaultTy peDescript or.System. ComponentM odel.ICust omTypeDesc riptor.Get Properties ()
at System.ComponentModel.Type Descriptor .GetProper ties(Type componentType)
at System.Windows.Forms.Desig n.FormDocu mentDesign er.Initial ize(ICompo nent component)
at System.ComponentModel.Desi gn.Designe rHost.AddT oContainer PostProces s(ICompone nt component, String name, IContainer containerToAddTo)
at System.ComponentModel.Desi gn.Designe rHost.Add( IComponent component, String name)
at System.ComponentModel.Desi gn.Designe rHost.Syst em.Compone ntModel.De sign.IDesi gnerHost.C reateCompo nent(Type componentType, String name)
at System.ComponentModel.Desi gn.Seriali zation.Des ignerSeria lizationMa nager.Crea teInstance (Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Desi gn.Seriali zation.Des ignerSeria lizationMa nager.Syst em.Compone ntModel.De sign.Seria lization.I DesignerSe rializatio nManager.C reateInsta nce(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Desi gn.Seriali zation.Typ eCodeDomSe rializer.D eserialize (IDesigner Serializat ionManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Desi gn.Seriali zation.Cod eDomDesign erLoader.P erformLoad (IDesigner Serializat ionManager manager)
at Microsoft.VisualStudio.Des ign.Serial ization.Co deDom.VSCo deDomDesig nerLoader. PerformLoa d(IDesigne rSerializa tionManage r serializationManager)
at Microsoft.VisualStudio.Des ign.Serial ization.Co deDom.VSCo deDomDesig nerLoader. DeferredLo adHandler. Microsoft. VisualStud io.TextMan ager.Inter op.IVsText BufferData Events.OnL oadComplet ed(Int32 fReload)
I have searched Google fruitlessly, and have tried building alternative forms with the same code amongst other things, but nothing I have tried has been any help. Anyone got any suggestions?
Chris Bray
The symptoms are that none of the inheriting forms will open in the designer, although all are fine at runtime. The designer fails to load the form, giving a typically opaque and stupid error message that only Microsoft could think would be acceptable: The path is not of a legal form. Not what path, or where, or anything about it other than it is not in the form it wants!
The full error message is:
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.
The path is not of a legal form.
Hide
at System.Signature._GetSigna
at System.Signature.GetSignat
at System.Signature..ctor(Run
at System.Reflection.RuntimeM
at System.Reflection.RuntimeM
at System.Reflection.RuntimeP
at System.ComponentModel.Refl
at System.ComponentModel.Refl
at System.ComponentModel.Type
at System.ComponentModel.Type
at System.ComponentModel.Type
at System.Windows.Forms.Desig
at System.ComponentModel.Desi
at System.ComponentModel.Desi
at System.ComponentModel.Desi
at System.ComponentModel.Desi
at System.ComponentModel.Desi
at System.ComponentModel.Desi
at System.ComponentModel.Desi
at Microsoft.VisualStudio.Des
at Microsoft.VisualStudio.Des
I have searched Google fruitlessly, and have tried building alternative forms with the same code amongst other things, but nothing I have tried has been any help. Anyone got any suggestions?
Chris Bray
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi cookre:
Following on from your comment I went back and checked again, and despite my having done everything I described previously two unused references in one of the projects were indeed dead - despite my having replaced all of them this afternoon. The only difference I can think of was an automated MS update...
It has solved the problem on my main machine, and I have sent a message to my coding partner who has the laptop to check for the same error. I will post back if it resolves that issue as well.
Great help, quick response, points are yours!
Chris Bray
Following on from your comment I went back and checked again, and despite my having done everything I described previously two unused references in one of the projects were indeed dead - despite my having replaced all of them this afternoon. The only difference I can think of was an automated MS update...
It has solved the problem on my main machine, and I have sent a message to my coding partner who has the laptop to check for the same error. I will post back if it resolves that issue as well.
Great help, quick response, points are yours!
Chris Bray
This is the best discussion on the topic
http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/10c9fa4d-c980-42ac-9846-74185dd44379
"... I then checked the properties of the main app, tab 'Publish', and then 'Application Files' button. List looked fine. Then I discovered one small little tiny 'Show all files' check box in the dialog. Only this revealed a referenced library that was no longer there...."
: ....I encountered this problem when I was using a form that inherited from another form that I had designed myself.The problem in my case turned out to be that the designer calls the constructor of the form you wish it to display.Therefore you must have a chain of constructors with no paramters, since the desinger will call those.
...."
Also check for namespace conflicts and missing type definitions;
http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/10c9fa4d-c980-42ac-9846-74185dd44379
"... I then checked the properties of the main app, tab 'Publish', and then 'Application Files' button. List looked fine. Then I discovered one small little tiny 'Show all files' check box in the dialog. Only this revealed a referenced library that was no longer there...."
: ....I encountered this problem when I was using a form that inherited from another form that I had designed myself.The problem in my case turned out to be that the designer calls the constructor of the form you wish it to display.Therefore you must have a chain of constructors with no paramters, since the desinger will call those.
...."
Also check for namespace conflicts and missing type definitions;
ASKER
Indeed I have. I have also removed every single one, and then put them back individually just to make absolutely certain...
Chris Bray