Link to home
Start Free TrialLog in
Avatar of chrisbray
chrisbrayFlag for United Kingdom of Great Britain and Northern Ireland

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._GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr declaringTypeHandle)
at System.Signature.GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, RuntimeFieldHandle fieldHandle, RuntimeMethodHandle methodHandle, RuntimeTypeHandle declaringTypeHandle)
at System.Signature..ctor(RuntimeMethodHandle methodHandle, RuntimeTypeHandle declaringTypeHandle)
at System.Reflection.RuntimeMethodInfo.get_Signature()
at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetProperties(Type type)
at System.ComponentModel.ReflectTypeDescriptionProvider.ReflectedTypeData.GetProperties()
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties()
at System.ComponentModel.TypeDescriptor.GetProperties(Type componentType)
at System.Windows.Forms.Design.FormDocumentDesigner.Initialize(IComponent component)
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)
at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
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 Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(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
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chrisbray

ASKER

Hi cookre:

Indeed I have.   I have also removed every single one, and then put them back individually just to make absolutely certain...

Chris Bray
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
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;