Attempting to use CSLA (latest version) along with ReactiveUI and Reactive Extensions.
When creating the WPF bindings using reactiveUI, the underlying logic uses the reactive extensions Observable.FromEventPattern to hook into the CSLA model's PropertyChanged events in BindableBase.
The problem that is occurring is that CSLA believes that these handlers should be serializable.
This is determined by the code,
if (value.Method.IsPublic && (value.Method.DeclaringType.IsSerializable || value.Method.IsStatic)) _serializableChangedHandlers = (PropertyChangedEventHandler) System.Delegate.Combine(_serializableChangedHandlers, value); else _nonSerializableChangedHandlers = (PropertyChangedEventHandler) System.Delegate.Combine(_nonSerializableChangedHandlers, value);
In this situation, the method is an anonymous delegate created within reactive extensions where
the value.Method is public and the value.Method.DeclaringType is System.Action`2[[System.Object],[System.ComponentModel.PropertyChangedEventArgs]]
which is marked as IsSerializable is true
This causes the handler to be added to the serializable list.
Any suggestions on what I might be able to do to change this situation?
I did accept your pull request regarding this issue, thank you.
Fwiw, I didn't like accepting the pull request, because really what we're doing is accommodating a flawed implementation in ReactiveUI - at least that's my view.
I'd like to understand why they made their types serializable if they aren't, in fact, serializable or intended to be serialized.
Copyright (c) Marimer LLC