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.