SerializationException

SerializationException

Old forum URL: forums.lhotka.net/forums/t/7745.aspx


dg78 posted on Wednesday, October 07, 2009

Hi,

 

I have this exception : "End of Stream encountered before parsing was completed."

in BinaryFormatterWrapper.vb, inside the Public Function Deserialize on the instruction :

Return _formatter.Deserialize(serializationStream).

 

This exception happens on a "big" object. I saw in a "small" object that the problem is about I forgot to put a <Serializable()> _ before an internal class.

 

Now my question :

Is it possible to see easily what type is not serializable ?

 

Perhaps it would be good to add in CSLA a test to avoid this problem.

 

(I use CSLA VB 3.53)

 

Thanks

 

Dominique

RockfordLhotka replied on Wednesday, October 07, 2009

There's really no way for CSLA to test for this condition - the only way to know if your object graph is serializable is to run it through the serializer. This is all handled by .NET.

I'm not aware of a tool or function that will tell you that you've referenced a non-serializable object.

But it doesn't sound like that's your problem. It sounds like your stream is incomplete - like it was truncated or something.

dg78 replied on Thursday, October 08, 2009

Thanks, Rocky, for your answer.

 

I found where is my problem.

 

In my "big" object, I put for some tests :

  Private _FilteredEmployeAdresse As FilteredBindingList(Of EmployeJEmployeAdresse)

 

But  FilteredBindingList is not serializable then there is a problem during the serialization of the object, but I did not see it and the exception appears during the deserialization.

 

I think that I need to use a Serializable class that inherits from FilteredBindingList.

ajj3085 replied on Thursday, October 08, 2009

FilteredBindingList is really only meant to be used on the client, to display a filtered list of users. There's no reason for a BO to have an instnace of that class as a member.

dg78 replied on Thursday, October 08, 2009

Yes, I think now that it is not a good idea to do as I did, I put that for some tests and I forgot to remove.

 

Rocky, when do you write a book about the best practices to use CSLA, not inside CSLA (you wrote already) but how to use it with many .. many shorts samples for many situations ?

I think that you planed it. What's about ?

Copyright (c) Marimer LLC