Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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:
Add DefaultValueAttribute to the property, specifying the default value. When the property is set to a value other than the default, the property is serialized.
Add DesignerSerializationVisibilityAttribute to the property and set the visibility to either Visible or Content.
Add a method named
ShouldSerialize<PropertyName>
and return a value that indicates whether or not the property should be serialized. For more information, see Use Reset and ShouldSerialize to control a property.
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.
.NET Desktop feedback