Skip to content

There is a bug for deserializing List<T>or IEnumerable<T> when using httpResponse.Content.ReadAsAsync<List<T> function #8

Open
@zfkingth

Description

@zfkingth

should CanReadTypeCore function change as follow:

    private static bool CanReadTypeCore(Type type)
    {
        bool isCan = type.GetCustomAttributes(typeof(ProtoContractAttribute)).Any();

        if (!isCan && typeof(IEnumerable).IsAssignableFrom(type))
        {
            var temp = type.GetGenericArguments().FirstOrDefault();
            isCan = temp.GetCustomAttributes(typeof(ProtoContractAttribute)).Any();
        }

        return isCan;
    }

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