Common Genius

The online technical home of David Nelson
Welcome to Common Genius Sign in | Join | Help
in Search

Variable Irony

A commentary on technical issues ranging far and wide.

DataSet/DataTable serialization bug with modified row and newline string value

Recently I ran across an unusual bug in the .NET framework. Our application uses .NET remoting with DataSets, using RemotingFormat = SerializationFormat.Xml (the default in .NET 2.0, and the only option in .NET 1.1). We were getting a DBConcurrencyException when trying to save data that was being passed from the client to the server, even though we knew for certain that the data in the database had not changed. After some investigation we discovered that the problem was related to a field in a modified row that had a value of "\r\n", i.e. the ascii values 10 and 13. Although the row had been modified, that field had not, so the original and current values were the same. However, examining the same data after it had been passed to the server, the original value of that field in the modified row was not "\r\n", but an empty string. Capturing the xml for the serialized DataSet (by serializing it to a file) showed the following xml node being used for that field value:

<ColumnName xml:space="preserve">
</ColumnName>

The exact same node was used for the original and current serialized values. However, when the DataSet was deserialized, the current value was correct, but the original value was not.

It turns out that the scenario is easily reproducable using the information obtained above. I submitted a bug report to Microsoft at https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=247212. The code for reproducing the issue is there, if you are interested.

Published Friday, December 22, 2006 2:05 AM by dnelson

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems