'System.Data.DataRow' not marked as serializable
-
Monday, October 13, 2008 9:46 AM
Hi,
I am getting the following error when attempting to persist my work flow.
Type 'System.Data.DataRow' in Assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Any ideas?
All Replies
-
Monday, October 13, 2008 2:01 PM
I know that the DataRow object is not serializable and that this is the root cause of the error.
My code is as follows:
Code Snippet[Serializable]
public partial class ApprovalGroupsRow : System.Data.DataRow {...}
If I remove the Serializable tag it complains that the ApprovalGroupsRow must be serializable...
-
Monday, October 13, 2008 5:06 PMA DataRow is not serializable, but a DataTable is. Use that as your field instead. The fact is you shouldn't be able to create a custom DataRow class without a custom DataTable class anyway because of methods used by the DataTable class to create new row objects.
-
Tuesday, October 14, 2008 7:45 AMThank you for the comment. I am slightly confused as the code sample give above is generated code found in my .Designer.cs file of my DataSet. How can I make this change?
-
Thursday, October 30, 2008 5:22 PM
Do you need this data to be persisted? If not mark it as NonSerialized.
Thanks,
Joel
-
Friday, October 02, 2009 12:53 PM
Had a similar problem today. Assuming that the data row is a private variable, then the workaround for this is to implement the ISerializable interface, add the _dataRow.Table object to the SerializationInfo object in the GetObjectData method as well as an int or string containing the id or composite key of the data row. Then create a constructor for the class used to deserialize the object, get the table and id back from the SerializationInfo and reset the private data row using the id and table.- Proposed As Answer by Catster Friday, October 02, 2009 12:53 PM
-
Tuesday, March 08, 2011 10:21 PM
Marked as helpful. In my case, the data did not need to be persisted.

