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

Posted on 2009-04-29
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
    LVL 23

    Accepted Solution

    Have you verified that ALL reference paths in ALL projects are still correct"?

    That seems to be the most common explanation.
    LVL 3

    Author Comment

    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
    LVL 3

    Author Comment

    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

    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;


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now