DefaultValue on DataColumn
I think I have discoverd a bug when setting the DefaultValue property on DataColumn and serializing a DataSet.
Our source table does not allow nulls. So, when my client requests a Dataset, we loop through the returned DataSet and set a DefaultValue for each 'does not allow nulls' DataColumn. We do this as we are DataBinding and using a CurrencyManager to mange the binding. The CurrencyManager frowns if the clients does not provide a value for a column that does not allow nulls on an Insert. So, assuming the user did not set the value on an Insert, there will be a DefaultValue.
The client updates the Dataset and sends the Dataset changes back to our Data Tier type. There, we use DataAdapter to push the updates back to our datasource. When using a local data tier type, all works well. When using a remoted data tier type, we get a serialization exception on the dataset when the client is passing the dataset as a param to the data tier type (remoted, hosted by IIS). We are using the SoapFormatter and it seems the dataset cannot be serialized once a DataColumn DefaultValue is set .
As a test, I created a test database that mirrors our existing one. I changed the table in question to allow nulls. I removed the code that sets DataColumn.DefaultValue in my client. All worked well with the local and remoted data tier type.
This leads me to believe there is a .net bug in serializing a dataset where datacolumn.defaultvalue properties have been set.