Hi,
I'm previously haunted by a bug which is now in Knowledge Base Article
818587 (Fix: Regression in Dataset Serialization in Visual Studio .NET 1.1
when a datarow contains a rowError or a ColumnError Property) which can be
found at http://support.microsoft.com/default...b;en-us;818587.
Please note that this bug only shows itself if the Windows Form Application
is run on dotNetFramework 1.1 but does not shows itself if the same
application is forced to run on dotNetFramework 1.0
Now, I think I found another bug which produces the same error message as
the bug above and it also has something to do with the rowError or a
ColumnError property. Even worse, the bug exists in dotNetFramework 1.1 and
also dotNetFramework 1.0. The error message is,
System.InvalidOperationException: There is an error in XML document (x,
xxxx).
---> System.NullReferenceException: Object reference not set to an
instance of an object.
To reproduce the bug,
1. Create a Web service with a dummy method.
<WebMethod()> Public Function Dummy(ByVal ds As DataSet) As DataSet
Return ds
End Function
2. Create a Windows Application or a Console Application and add the service
that you created in step 1 as a Web Reference.
3. Type in or paste the following code,
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet
Dim dt As DataTable
Dim row As DataRow
Dim i As Integer
' Create a new DataTable
dt = New DataTable
dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))
' Create a new DataSet and add the DataTable into it
ds = New DataSet
ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)
' Fill the DataTable with dummy values
For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)
Next
' Set error message to the rows
For Each row In ds.Tables("TestTable").Rows
' Setting the RowError property below will cause and
' exception is thrown when calling ws.Dummy(ds.GetChanges).
row.RowError = "Row has not been updated to the server yet."
Next
' Send DataSet to the WebService
Try
ws = New localhost.Service1
ws.Dummy(ds.GetChanges)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
ws.Dispose()
End Sub
Can anyone confirm this? Thanks a lot.