Skip to content

XmlArrayItemAttribute with IsNullable=true on collection of non-nullable elements #551

@bassem-mf

Description

@bassem-mf

Steps to reproduce:

Generate classes from the Authorize.Net XML schema file using the following command.

xscgen https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd

See the property GetMerchantDetailsResponse.PaymentMethods on line 10021.

[System.Xml.Serialization.XmlArrayItemAttribute("paymentMethod", IsNullable=true, Namespace="AnetApi/xml/v1/schema/AnetApiSchema.xsd")]
public System.Collections.ObjectModel.Collection<PaymentMethodsTypeEnum> PaymentMethods

IsNullable=true is not valid here because PaymentMethodsTypeEnum is not nullable.

The XmlSerializer constructor throws the following exception.

InvalidOperationException: IsNullable may not be 'true' for value type AnetApi.Xml.V1.PaymentMethodsTypeEnum. Please consider using Nullable<AnetApi.Xml.V1.PaymentMethodsTypeEnum> instead.

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