Skip to content

Android version fails to deserialize nullable enum #11

@tho-sch

Description

@tho-sch

I am using version 2.0.0.6 (latest on NuGet) in a Xamarin.Android project targeting API Level 15. The following Json string fails to deserialize:
{"NewDataAvailable":false,"ServiceAction":null}

This is the corresponding class:

[DataContract]
public class DeviceNotification
{
    [DataMember]
    public bool NewDataAvailable { get; set; }

    [DataMember]
    public DeviceServiceAction? ServiceAction { get; set; }
}

DeviceServiceAction is an enum.

When trying to deserialize, I receive the following error:
System.Exception: Bad number (int) at 42 (found: '\110')

The problem only occurs when ServiceAction is null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions