adding
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[DefaultValue(false)]
in front of my properties resolved the issue.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I've started a new project and loaded old .cs files from a previous project.
app won't compile because all my properties are complaining about the same issue
e.g.
bool bolAllowDecimal = false;
public bool AllowDecimal
{
get { return bolAllowDecimal; }
set { bolAllowDecimal = value; }
}
causes error code : Property 'AllowDecimal' does not configure the code serialization for its property content
what is this????!??
adding
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[DefaultValue(false)]
in front of my properties resolved the issue.
Hello @Christ Kennedy ,
Thank you for contact Microsoft Q&A. After review your description, I will clarify why the compilation error occurred and summarize the solution below:
.cs files into a C# 2026 project caused compilation errors for all properties:
Property 'AllowDecimal' does not configure the code serialization for its property content
bool bolAllowDecimal = false;
public bool AllowDecimal
{
get { return bolAllowDecimal; }
set { bolAllowDecimal = value; }
}
This happened because the designer in C# 2026 (Windows App SDK) looks for serialization attributes on the property itself. In the imported code the attributes were applied to the backing field, so the designer ignored them and couldn't configure property serialization which caused the compilation error.
[DesignerSerializationVisibility] and [DefaultValue] to the field instead of the property, so the compiler could not configure serialization.As I can see your solution had worked perfectly:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[DefaultValue(false)]
public bool AllowDecimal
{
get { return bolAllowDecimal; }
set { bolAllowDecimal = value; }
}
You can read more information about property serialization in Windows App SDK here:
I hope this explanation clarifies the root cause of the compilation errors. If you have any further questions, feel free to ask!