Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization Issues at Design Time with CustomType Properties Using CustomCodeDomSerializer and CodeExpression in overidden Serialize Method #12754

Open
ChidanandMurugaiah opened this issue Jan 10, 2025 · 0 comments
Labels
untriaged The team needs to look at this issue in the next triage

Comments

@ChidanandMurugaiah
Copy link

ChidanandMurugaiah commented Jan 10, 2025

Environment

Visual Studio professional 2022 - version 17.12.0

.NET version

.NET 8

Did this work in a previous version of Visual Studio and/or previous .NET release?

No

Issue description

We are currently working with a custom type property that utilizes a CustomCodeDomSerializer as its DesignerSerializer. Within the CustomCodeDomSerializer class, the CodeExpression is employed in the Serialize method.

However, this implementation is causing serialization issues. Specifically:

When the property value is changed in the property window, the updated code is not generated in the Form1.Designer.cs file.
Upon rebuilding the solution, the changes made in the property window are reverted.
Through design-time debugging, we identified that the Serialize method is not being triggered for property changes. The root cause appears to be the inclusion of the CodeExpression in the serialization logic. When this line is commented out, the Serialize method triggers as expected.

However, in our scenario, the CodeExpression is essential for serializing the data.

We would appreciate any guidance or suggestions on resolving this issue while maintaining the use of CodeExpression in the serialization process.

Demo link - CodeDomSerializerIssue.zip

Steps to reproduce

1.Open the Designer.
2.Click the CustomControl and go to the propertwindow.
3.Expand the ColorCheck (Custom property) and change the Color property.
4.Save the changes and check the form1.Designer.cs page.

Expected Behavior - Changes needs to be added in the Designer.cs page.
Observed Behavior - Changes are not added in the Designer.cs page.

  1. Rebuild the solution and open the property window.

Expected Behavior - Updated values needs to maintain in the property window.
Observed Behavior - property value changes to its Default value.

@ChidanandMurugaiah ChidanandMurugaiah added the untriaged The team needs to look at this issue in the next triage label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged The team needs to look at this issue in the next triage
Projects
None yet
Development

No branches or pull requests

1 participant