SerializationException With DataTable
-
Hello, I'm trying to access a DataTable from a Typed Dataset through Remoting but when I call my method it throws the follow exception: [SerializationException] The constructor to deserialize an object of type TBPerfilDataTable was not found. But, when I try to return the full filled typed dataset it works... It only doesn't works with DataTables. Any idea? Wender Oliveira .NET Programmer
-
Hello, I'm trying to access a DataTable from a Typed Dataset through Remoting but when I call my method it throws the follow exception: [SerializationException] The constructor to deserialize an object of type TBPerfilDataTable was not found. But, when I try to return the full filled typed dataset it works... It only doesn't works with DataTables. Any idea? Wender Oliveira .NET Programmer
Hi Wender, I'm not really sure if the TBPerfilDataTable class needs to have a default constructor (without any parameters). If I access an object using serialization (e.g. by using a WebSerice), the serialized class always needs a constructor without parameters. Is your datatable marked as serializable ? Regards Sebastian Trying to be a .NET Programmer ;-)
-
Hello, I'm trying to access a DataTable from a Typed Dataset through Remoting but when I call my method it throws the follow exception: [SerializationException] The constructor to deserialize an object of type TBPerfilDataTable was not found. But, when I try to return the full filled typed dataset it works... It only doesn't works with DataTables. Any idea? Wender Oliveira .NET Programmer
-
Hi Wender, I'm not really sure if the TBPerfilDataTable class needs to have a default constructor (without any parameters). If I access an object using serialization (e.g. by using a WebSerice), the serialized class always needs a constructor without parameters. Is your datatable marked as serializable ? Regards Sebastian Trying to be a .NET Programmer ;-)
Sebastian, thanks for your attention First it throws an exception about Serializable Attribute not found, so, I marked all my datatable classes as [Serializable()]. Then, I tried again and got that exception. I tried to reimplement ISerializable interface but I didn't understande how to do this. Wender Oliveira .NET Programmer
-
If you are deriving from the DataTable class, then you must add the following code protected MyDataTable(SerializationInfo info, StreamingContext context):base(info, context) { }
Thanks, I didn't try but it seems to work. I did an workaround and now works... :-) Tks... Wender Oliveira .NET Programmer