-
Why doesn't the unit test expect MaybeNull and AllowNull on empty collections? [XmlIgnoreAttribute()]
private String[] _text;
// generated code is missing analysis attributes
// [AllowNullAttribute()]
// [MaybeNullAttribute()]
[XmlElementAttribute("Text")]
public String[] Text
{
get
{
return _text;
}
set
{
_text = value;
}
} PS: The XmlSerializer is inconsitent when initializing |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
XmlSchemaClassGenerator/XmlSchemaClassGenerator/TypeModel.cs Lines 603 to 612 in 269889d |
Beta Was this translation helpful? Give feedback.
-
I think this may stem from a time prior to |
Beta Was this translation helpful? Give feedback.
-
I'm thinking to change the cited code like this: private bool IsNullable => DefaultValue == null && !IsRequired;
private bool IsValueType => PropertyType is EnumModel || (PropertyType is SimpleModel model && model.ValueType.IsValueType);
private bool IsNullableValueType => IsNullable && !IsEnumerable && IsValueType;
private bool IsNullableReferenceType => IsNullable && (!IsEnumerable || !IsPrivateSetter) && (PropertyType is ClassModel || (PropertyType is SimpleModel model && !model.ValueType.IsValueType)); |
Beta Was this translation helpful? Give feedback.
-
OK done in 3a97825 |
Beta Was this translation helpful? Give feedback.
I'm thinking to change the cited code like this: