You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of how XmlSchemaClassGenerator generates C# properties for choices (see choice), all properties generated from items in a choice must be nullable.
The current implementation of XmlSchemaClassGenerator only forces the direct children of choices to nullable. It does not force any descendants nested deeper than its children to nullable and might therefore generate invalid code in those cases.
public partial class Root
{
[System.ComponentModel.DataAnnotations.RequiredAttribute()]
public int Element { get; set; }
[System.ComponentModel.DataAnnotations.RequiredAttribute()]
public int GroupRefChild { get; set; }
}
which isn't valid since both the properties are required when they must be nullable according to how XmlSchemaClassGenerator handles choice elements.
The text was updated successfully, but these errors were encountered:
Because of how XmlSchemaClassGenerator generates C# properties for choices (see choice), all properties generated from items in a choice must be nullable.
The current implementation of XmlSchemaClassGenerator only forces the direct children of choices to nullable. It does not force any descendants nested deeper than its children to nullable and might therefore generate invalid code in those cases.
For example the following schema file:
generates a class that looks something like this:
which isn't valid since both the properties are required when they must be nullable according to how XmlSchemaClassGenerator handles choice elements.
The text was updated successfully, but these errors were encountered: