Binding to Business Object w/FilteredBindingList gives SerializationException

Binding to Business Object w/FilteredBindingList gives SerializationException

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


FrodeNilsen posted on Friday, April 25, 2008

Short version: When you bind to a business object that contains a property of type FilteredBindingList<...> that is not null, the .Net framework gives you a SerializationException. Is there any way around this?

Long version: I have created a test project, FilteredBindingTest, you can download it here. I want to be able to maintain a FilteredBindingList reference in my bound business object, but that seems to be a problem. I know FilteredBindingList isn't supposed to be serialized, so I thought I'd solve the problem by adding the [NonSerialized] attribute to the private property, but no. The problem only occurs when the property is instantiated.

If I drill down in the databinding process, I think it is the Clone() call in relation to the BeginEdit() due to the DataGridView-binding, that is the problem.

I am using CSLA 3.0.4

Any ideas?


RockfordLhotka replied on Friday, April 25, 2008

You also have to mark the field as NotUndoable, otherwise the n-level undo feature will attempt to serialize the object.

FrodeNilsen replied on Monday, April 28, 2008

Thanks a lot, that did the trick!

Copyright (c) Marimer LLC