Edit

Share via


Compiler Error WFO1000

Version introduced: .NET 9

Property does not configure the code serialization for its property content.

Properties of classes derived from Control must indicate whether or not they're serializable. The designer needs this information to ensure that controls are serialized accurately.

By default, the Windows Forms designer serializes every public property of a Control that doesn't specify a serialization preference. This might result in leaking private data into the designer's serialization of the control. This error ensures that you explicitly declare the serialization of every public property of the control.

To correct this error

Indicate serialization of the property.

If the property should be serialized by the designer, configure serialization in one of the following ways:

If the property shouldn't be serialized by the designer, add DesignerSerializationVisibilityAttribute to the property and set the visibility to Hidden.

Manage the error

Suppress the error with either of the following methods:

  • Set the severity of the rule in the .editorConfig file.

    [*.{cs,vb}]
    dotnet_diagnostic.WFO1000.severity = none
    

    For more information about editor config files, see Configuration files for code analysis rules.

  • Add the following PropertyGroup to your project file:

    <PropertyGroup>
        <NoWarn>$(NoWarn);WFO1000</NoWarn>
    </PropertyGroup>
    
  • Suppress in code with the #pragma warning disable WFO1000 directive.