Table of Contents

Diagnostics Warning STRDIAG000

There is an Attribute Contradiction on '{0}' Member. [DataMemberIgnore] Attribute on a [DataMember] is not supported. Except if it has also [DataMemberUpdatable] Attribute.

Explanation

Adding DataMemberAttribute and DataMemberIgnoreAttribute to the same member is not supported. This would be a contradiction. It would mean the serializer should serialize the member and ignore it at the same time. The DataMemberUpdatableAttribute makes the combination valid again as it negates the DataMemberIgnoreAttribute for the binary serializer.

Example: Invalid cases

The following example generates STRDIAG000 on each property:

// STRDIAG000.cs
using Stride.Core;

public class STRDIAG000
{
    [DataMember]
    [DataMemberIgnore]
    public int Value { get; set; }

    [DataMember]
    [DataMemberIgnore]
    public int Value;
}

Example: Special Case DataMemberUpdatable

Important

There is a special case if the DataMemberUpdatableAttribute is applied. This Attribute negates the DataMemberIgnoreAttribute for the binary Serializer, so it becomes valid again.

using Stride.Core;

public class STRDIAG000
{
    [DataMember]
    [DataMemberIgnore]
    [DataMemberUpdatable]
    public int Value { get; set; }
}

Solution

To resolve the warning, pick either the DataMemberAttribute or the DataMemberIgnoreAttribute. If the YamlSerializer and the Editor should ignore the member but the binary serializer not, then add the DataMemberIgnoreAttribute.

References