"An error occurred while analyzing EntityName". What is the problem with the Windows designer?

Source: Internet
Author: User

Recently, I began to maintain a WinForm tool and software for my colleagues. It was developed with C # In VS2005. After the source code is obtained, it is re-compiled and runs properly. The Code is also written in a standard way. Then, based on user requirements, I added several functions in the background code one after another, which was quite smooth. A few days ago, I had to modify the main interface and suddenly found that MainForm could not be opened in the window designer. The IDE prompts "An error occurred while analyzing EntityName. Row 2, position 47 ."!

At first, I thought it was an error when the Windows designer Parsed the MainForm. Design. cs file, causing the interface to fail to be displayed. However, I checked the file and found no syntax errors. The compilation was successful. Then I suspected it was a problem with VS2005. Since VS2005 and 2008 are installed on my desktop, 2005 has almost never been used in more than a year. Will it be caused by a file damage to the designer? So I switched to 2008 to view the results. Copy the source code to my notebook and use 2008 to view it. The error is still reported. It's impossible for two machines to stop at the same time, 2005 and 2008 ?!

In desperation, I continued to open it on another colleague's computer. Sorry, no matter whether it's 2005 or 2008, it's okay. From this point of view, it has nothing to do with IDE.

I read the details of an error. The call stack for an error is:

In System. xml. xmlTextReaderImpl. throw (Exception e) in System. xml. xmlTextReaderImpl. throw (String res, String arg) in System. xml. xmlTextReaderImpl. parseEntityName () in System. xml. xmlTextReaderImpl. parseAttributeValueSlow (Int32 curPos, Char quoteChar, NodeData attr) in System. xml. xmlTextReaderImpl. parseAttributes () in System. xml. xmlTextReaderImpl. parseElement () in System. xml. xmlTextReaderImpl. parseElementContent () in System. xml. xmlTextReaderImpl. read () in System. xml. xmlTextReader. read () in Microsoft. visual Studio. design. VSTypeResolutionService. generatedAssemblyEntry. realizeMoniker (String moniker) in Microsoft. visual Studio. design. VSTypeResolutionService. generatedAssemblyEntry. get_FileName () in Microsoft. visual Studio. design. VSTypeResolutionService. assemblyEntry. get_Assembly () in Microsoft. visual Studio. design. VSTypeResolutionService. generatedAssemblyEntry. get_Assembly () in Microsoft. visual Studio. design. VSTypeResolutionService. assemblyEntry. search (String fullName, String typeName, Boolean ignoreTypeCase, Assembly & assembly, String description) in Microsoft. visual Studio. design. VSTypeResolutionService. searchGeneratedEntries (AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly & assembly) in Microsoft. visual Studio. design. VSTypeResolutionService. searchEntries (AssemblyName assemblyName, String typeName, Boolean ignoreCase, Assembly & assembly, ReferenceType refType) in Microsoft. visual Studio. design. VSTypeResolutionService. getType (String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType) in Microsoft. visual Studio. design. serialization. codeDom. aggregateTypeResolutionService. getType (String name, Boolean throwOnError, Boolean ignoreCase) in Microsoft. visual Studio. design. serialization. codeDom. aggregateTypeResolutionService. getType (String name, Boolean throwOnError) in System. componentModel. design. serialization. codeDomSerializerBase. getType (ITypeResolutionService trs, String name, Dictionary '2 names) in System. componentModel. design. serialization. codeDomSerializerBase. fillStatementTable (IDesignerSerializationManager manager, IDictionary table, Dictionary '2 names, CodeStatementCollection statements, String className) in System. componentModel. design. serialization. typeCodeDomSerializer. deserialize (IDesignerSerializationManager, CodeTypeDeclaration declaration) in System. componentModel. design. serialization. codeDomDesignerLoader. performLoad (IDesignerSerializationManager) in Microsoft. visual Studio. design. serialization. codeDom. VSCodeDomDesignerLoader. performLoad (IDesignerSerializationManager serializationManager) in Microsoft. visual Studio. design. serialization. codeDom. VSCodeDomDesignerLoader. deferredLoadHandler. microsoft. visual Studio. textManager. interop. IVsTextBufferDataEvents. onLoadCompleted (Int32 fReload)

It seems to be related to XML parsing, so I began to search for answers online. After Baidu, some people mentioned that if a symbol appears in the XML file, the parser will treat it as an escape character...

So I checked all the XML files in the solution again and did not find any headache &. When I was puzzled, I suddenly found that the code was put together with some related development documents in A directory named "S &, will "&" in this directory name be the culprit? Immediately, change the directory name to "SA", so an error occurred while analyzing the EntityName. The main form appeared, and the world was quiet...

In retrospect, when my colleague gave me the source code, he named it "Statistic_Analysis", and the name was a little long. I put the source code and other development documents under the same directory, and I got A simple name: S &. Then, when I found a problem in my desktop and notebook, I carried this directory name. When I tried it on my colleague's computer, I only sent the source code. Therefore, we have encountered the strange phenomenon mentioned above. The problem has been solved and I am in a good mood. I tried it again in VS2010 and the problem has not been reproduced. It seems that I have experienced two versions: 2005 and 2008, microsoft has completely solved this BUG on 2010.


I don't know how many people are suffering from the Windows designer and this "&" like me?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.