Skip to content

Support for internal classes #88

Closed

Description

@alexvaluyskiy

I think it is a bit different from #40 and more important. For example there is a lot of internal classes in Akka.NET which should be serialized, but MsgPack does not support it

Activity

  1. neuecc commented on Oct 9, 2017

    @neuecc
    Member

    I've release v1.7.0, maybe it supports internal, too.

  2. alexvaluyskiy commented on Oct 11, 2017

    @alexvaluyskiy
    Author

    @neuecc Yes, internal members works now. thanks. This issue could be closed.

    Btw, there is no private replacement for TypelessContractlessStandardResolver. What is the best way to replace it? Is it OK?

    CompositeResolver.RegisterAndSetAsDefault(
        NativeDateTimeResolver.Instance,
        TypelessObjectResolver.Instance,
        ContractlessStandardResolverAllowPrivate.Instance);
    

    Also classes with private or internal constructors still don't work

  3. neuecc commented on Oct 11, 2017

    @neuecc
    Member

    Thanks, I'll add TypelessContractlessStandardResolverAllowPrivate.
    It is now possible to assemble it all.

    IFormatterResolver[] resolvers = new[]
    {
        NativeDateTimeResolver.Instance, // Native c# DateTime format, preserving timezone
        BuiltinResolver.Instance, // Try Builtin
        AttributeFormatterResolver.Instance, // Try use [MessagePackFormatter]
        DynamicEnumResolver.Instance, // Try Enum
        DynamicGenericResolver.Instance, // Try Array, Tuple, Collection
        DynamicUnionResolver.Instance, // Try Union(Interface)
        DynamicObjectResolver.Instance, // Try Object
        
    
        // You can change to DynamicContractlessAllowPrivateResolver
        DynamicContractlessObjectResolver.Instance, // Serializes keys as strings
        
        
        TypelessObjectResolver.Instance
    };

    Let me think about whether to include private constructors.
    There is also a way to fall back to GetUninitializedObject if a constructor is not found (Utf8Json does that)

  4. AArnott commented on Dec 13, 2019

    @AArnott
    Collaborator

    This issue was filed against a 1.x version of the library. A lot of changes have been made to this area in 2.0 and I suspect this is fixed or no longer applies. Please retry your scenario on 2.0 and comment here if you think the issue should be re-opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions