Can you please help me about the error "Illegal Characters in Path". I am developing SmartDevice application in VS.Net 2005. I m getting this error if i opens a form in Design Mode (For Smart Device Clients only not for Windows Application).

(NOTE: I Tried uninstalling and re-installing .Net Compact Framework but still it is giving the same problem)

(I also tried taking registry back of .NetCompactFramework and .netFrameWork keys from other PC where it is working properly and Merge these registry files in my PC but still the issue is not solved

And there is no Control on the Form)

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.

Illegal characters in path.


at System.IO.Path.CheckInvalidPathChars(String path)
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.VisualStudio.AssemblyEnumerationService.VSAssemblyEnumerator.System.Collections.IEnumerator.MoveNext()
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchSDKEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
at System.ComponentModel.TypeDescriptor.CreateDesigner(IComponent component, Type designerBaseType)
at System.ComponentModel.Design.DesignSurface.CreateDesigner(IComponent component, Boolean rootDesigner)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponent component, Boolean rootDesigner)
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.CodeDomSerializerBase.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.ComponentCodeDomSerializer.DeserializeInstance(IDesignerSerializationManager manager, Type type, Object[] parameters, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.DeserializeStatementToInstance(IDesignerSerializationManager manager, CodeStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.Windows.Forms.Design.ControlCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at Infragistics.Shared.Serialization.UltraCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, Object codeObject)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.DeserializeName(IDesignerSerializationManager manager, String name, CodeStatementCollection statements)

Re: XML and the .NET Framework Illegal Characters in Path" an error while opening the C# Form in VS 2005

Jyothi G


Add System.Design.dll,

Add System.Drawing.Design.dll

step 1: open the form in design view (the one which showing the Illegal error).

step 2: delete .Resx file

step 3: then again open the form.

try your luck.


Re: XML and the .NET Framework Illegal Characters in Path" an error while opening the C# Form in VS 2005

Robert Rossney

This isn't really an XML question, but I'll try answering it anyway:

Some component on your form has a property that is a pathname to a file or directory. Somewhere along the line, you've put some bad characters into this property. When you try to open the form in the designer, it's instantiating designers for all of the controls on the form, and when it hits this control, the control's designer is trying to construct the use this property in constructing a path. That (the Path.Combine) is what's throwing the exception.

What you need to do: open the form's designer.cs file, find the bad property value, and fix it.

It's super-annoying that VS just gives you this crappy stack trace without at least telling you what control it was working on when it got the exception.