You are currently offline, waiting for your internet to reconnect

FIX: Duplicate import schema may cause the XML schema compilation to fail

This article has been archived. It is offered "as is" and will no longer be updated.
When a duplicate import schema is encountered during compilation, System.xml may throw the following error message:
Item has already been added. Key in dictionary:"file:///C:/C.xsd" Key being added: "file:///C:/C.xsd"
  • In the previous error message, C:/C.xsd is the duplicate schema.
  • This hotfix cannot be applied on a system that is running the Microsoft .NET Framework 1.1 Service Pack 1. If you installed the .NET Framework 1.1 Service Pack 1 and are experiencing the symptoms that are described in this article, request the hotfix rollup package that is described in Microsoft Knowledge Base article 890673 to obtain a resolution. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
    890673 Availability of the .NET Framework 1.1 Post-Service Pack 1 XML Web services and XML Messaging hotfix rollup package 8
Although this problem occurs in both the Microsoft .NET Framework 1.0 and in the .NET Framework 1.1, this resolution only applies to the .NET Framework 1.1.

To apply this hotfix, your computer must be running the .NET Framework 1.1.

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft .NET Framework 1.1 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
    Date         Time   Version            Size    File name   --------------------------------------------------------------   29-Jun-2004  02:42  1.1.4322.1059     258,048  Aspnet_isapi.dll     29-Jun-2004  02:42  1.1.4322.1059      20,480  Aspnet_regiis.exe     29-Jun-2004  02:42  1.1.4322.1059      32,768  Aspnet_state.exe     29-Jun-2004  02:42  1.1.4322.1059      32,768  Aspnet_wp.exe       14-Jun-2004  21:45                     33,718  Installpersistsqlstate.sql   14-Jun-2004  21:45                     34,342  Installsqlstate.sql   14-Jun-2004  21:45                     35,243  Installsqlstatetemplate.sql   24-May-2004  23:04  1.0.3705.0        106,496  Netfxupdate.exe     29-Jun-2004  02:42  1.1.4322.1059      94,208  Perfcounter.dll     24-May-2004  23:04  1.1.4322.573      102,400  Setregni.exe        14-Jun-2004  21:45                      8,685  Smartnav.js   29-Jun-2004  02:42  1.1.4322.1059   1,224,704  Sy52106.dll         29-Jun-2004  02:42  1.1.4322.1059     241,664  System.messaging.dll     29-Jun-2004  02:42  1.1.4322.1059     323,584  System.runtime.remoting.dll     29-Jun-2004  02:42  1.1.4322.1059     131,072  System.runtime.serialization.formatters.soap.dll     29-Jun-2004  02:42  1.1.4322.1059   1,257,472  System.web.dll      29-Jun-2004  02:42  1.1.4322.1059     819,200     29-Jun-2004  02:42  1.1.4322.1059     569,344     29-Jun-2004  02:42  1.1.4322.1059   1,339,392  System.xml.dll      24-May-2004  23:04  1.1.4322.573      118,784  Togac.exe           14-Jun-2004  21:45                      2,119  Uninstallsqlstatetemplate.sql   14-Jun-2004  21:45                     14,482  Webuivalidation.js                                 
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
This problem may occur when you compile a duplicate schema, such as the following:

A.xsd imports B.xsd and C.xsd, and then B.xsd also imports C.xsd.

Steps to reproduce the problem

  1. Create a Microsoft Visual Studio .NET 2003 or a Visual Studio .NET 2002 Windows Forms application.
  2. Add a button to the default form.
  3. Add the following methods to the default Form class
    void LoadSchemas()		{			try			{				//A.xsd imports B.xsd and C.xsd, and then, B.xsd imports C.xsd.  				XmlSchema schemaA = LoadSchema(@"C:\A.xsd");				schemaA.Compile(null);				XmlSchema schemaC = ((XmlSchemaExternal)schemaA.Includes[0]).Schema;				XmlSchema schemaB = ((XmlSchemaExternal)schemaA.Includes[1]).Schema;				((XmlSchemaExternal)schemaB.Includes[0]).Schema = schemaC;					schemaA.Compile(new ValidationEventHandler(ValidationCallBack));			}			catch(Exception ex)			{				MessageBox.Show(ex.Message);			}		}				internal void ValidationCallBack(object sender, ValidationEventArgs args)		{			System.Diagnostics.Debug.WriteLine(args.Message);			MessageBox.Show(args.Message);		}  		static XmlSchema LoadSchema(string fileName)		{				XmlTextReader xmlTxtReader = null;				XmlSchema xmlSchema = null;			try			{					xmlTxtReader = new System.Xml.XmlTextReader(fileName);				xmlSchema = XmlSchema.Read(xmlTxtReader, null);			}			finally			{				if (xmlTxtReader != null)					xmlTxtReader.Close();			}			return xmlSchema;		}
  4. Change the button1_Click event handler as follows:
    private void button1_Click(object sender, System.EventArgs e)		{			LoadSchemas();		}
  5. Run the application.

    You may receive the error message that is mentioned in the "Symptoms" section.

Article ID: 870722 - Last Review: 01/17/2015 11:06:28 - Revision: 3.1

Microsoft .NET Framework 1.0, Microsoft .NET Framework 1.1

  • kbnosurvey kbarchive kbbug kbfix kbqfe kbhotfixserver KB870722