Learn how to a build a cloud-first strategyRegister Now


How can I fix a 'Path is not of a legal form' error

Posted on 2009-04-29
Medium Priority
Last Modified: 2012-05-06
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.

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
Question by:chrisbray
  • 2
LVL 22

Accepted Solution

cookre earned 2000 total points
ID: 24262711
Have you verified that ALL reference paths in ALL projects are still correct"?

That seems to be the most common explanation.

Author Comment

ID: 24262778
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

Author Comment

ID: 24262862
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
LVL 12

Expert Comment

ID: 24262957
This is the best discussion on the topic


"... 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;


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month20 days, 20 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question