CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum


CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • CSLA / Reactive Extensions Serialization issue

    rated by 0 users
    Answered (Not Verified) This post has 0 verified answers | 1 Reply | 2 Followers

    Not Ranked
    1 Posts
    bradtwurst posted on Tue, May 5 2015 7:02 PM

    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?
    
    

    All Replies

    Top 10 Contributor
    9,475 Posts
    Suggested by RockfordLhotka

    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.

    Rocky

    Page 1 of 1 (2 items) | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems