Microsoft KB Archive/818587

From BetaArchive Wiki
Knowledge Base


Article ID: 818587

Article Last Modified on 4/7/2006



APPLIES TO

  • Microsoft .NET Framework 1.1



SYMPTOMS

When you pass a dataset that contains a custom ColumnError property or a RowError property between a Web service and a client application, you receive the following exception error message:

System.InvalidOperationException: There is an error in XML document (1, 1216). 
   ---> System.NullReferenceException: Object reference not set to an instance of an object. 

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, 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 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
       --------------------------------------------------------------
       27-Jun-2003  15:01  1.1.4322.918    1,294,336  System.data.dll  
       30-Jun-2003  22:27  1.0.0.0         1,629,352  Ndp1.1-kb823679-x86.exe  
       03-Jul-2003  03:20  5.3.17.17         709,920  Windowsserver2003-kb821415-x86-enu.exe  
                

Note You must restart your computer for the hotfix to take affect. For additional information about how to apply this hotfix, see the readme file that is included with this hotfix.


Steps to reproduce the behavior

  1. Create a Web service with the following Web Service method to return a dataset with the ColumnError or the RowError property set:

    [WebMethod]
    public DataSet Test( )
    {
       // Build a dataset with one table and one field
       DataSet dataSet1 = new DataSet();
       dataSet1.Tables.Add("Table1");
       dataSet1.Tables["Table1"].Columns.Add("Field1", Type.GetType("System.String"));
    
       // Add a row to the table
       dataSet1.Tables["Table1"].Rows.Add(new object[] {"Server Value"});
       
       // Uncomment the following to test ColumnError. 
       // dataSet1.Tables["Table1"].Rows[0].SetColumnError("Field1", "Server Error Message");
    
       // Uncomment the following to test RowError.
       // dataSet1.Tables["Table1"].Rows[0].RowError = "Server Error Message";
      
       // Send dataset back to the client
       return dataSet1;
    }
     
  2. Create a console application, and then add the service that you created in step 1 as a Web Reference.
  3. Paste the following code in the Main() section:

    public static void Main() 
    {
       try
       {
          localhost.Service1 service1 = new localhost.Service1(); 
          // Get dataSet from the Web service
          System.Data.DataSet dsSer = service1.Test();
       }
       catch (Exception exc) 
       {
             Console.WriteLine(exc);
       }
    }
    

    Note Replace localhost with the appropriate Web service namespace.

  4. Compile and run the Web service.
  5. Compile and run the client application. The application throws the "System.InvalidOperationException" exception.

The exception stack

System.InvalidOperationException: There is an error in XML document (1, 1216). ---> System.NullReferenceException: Object reference not set to an instance of an object.
 at System.Xml.Serialization.XmlSerializationReader.UnknownNode(XmlNode unknownNode, Object o)
 at System.Xml.Serialization.XmlSerializationReader.UnknownNode(Object o)
 at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read3_TestResponse()
 --- End of inner exception stack trace ---
 at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
 at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
 at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
 at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
 at Serialization.Client.localhost.Service1.Test(Boolean setColumnError) in c:\documents and settings\jreece\my documents\visual studio projects\serializationtest\serialization.client\web references\localhost\reference.cs:line 37
 at Serialization.Client.Form1.button2_Click(Object sender, EventArgs e) in c:\documents and settings\jreece\my documents\visual studio projects\serializationtest\serialization.client\form1.cs:line 156

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Keywords: kbbug kbfix kbsystemdata kbqfe kbmanaged kbhotfixserver KB818587