Skip to content

System.Data.DataColumn serializes some properties with a default value (different from the .NET Framework) #11314

Closed

Description

Environment

Microsoft Visual Studio 2022
Version 17.9.3

.NET version

.NET 6 (we use)
.NET 8

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

Works in the same Visual Studio 2022 Version 17.9.3 or previous versions, but targeting to .NET Framework 4.8.

Issue description

We have a custom Component and ComponentDesigner those are used to create/populate multiple DataTable and DataColumn in the design-time.

After migrating to .NET 6 we are experiencing with an issue that each DataColumn serialize some properties to .Designer.cs and .resx files that looks needless and just increase file size and noise.

Previous code:

this.dataColumn35.ColumnName = "DischargedDate";
this.dataColumn35.DataType = typeof(System.DateTime);

Current code:

dataColumn35.Caption = "DischargedDate";
dataColumn35.ColumnName = "DischargedDate";
dataColumn35.DataType = typeof(System.DateTime);
dataColumn35.DefaultValue = resources.GetObject("dataColumn35.DefaultValue");
dataColumn35.Namespace = "";

and .resx

  <data name="dataColumn35.DefaultValue" mimetype="application/x-microsoft.net.object.binary.base64">
    <value>
        AAEAAAD/////AQAAAAAAAAAMAgAAAEhTeXN0ZW0uUHJpdmF0ZS5Db3JlTGliLCBDdWx0dXJlPW5ldXRy
        YWwsIFB1YmxpY0tleVRva2VuPTdjZWM4NWQ3YmVhNzc5OGUFAQAAAB9TeXN0ZW0uVW5pdHlTZXJpYWxp
        emF0aW9uSG9sZGVyAwAAAAREYXRhCVVuaXR5VHlwZQxBc3NlbWJseU5hbWUBAAEIAgAAAAoCAAAABgMA
        AAAACw==
</value>
  </data>

So, ton of Caption, DefaultValue, Namespace properties are added when changing the form design in new Windows Forms Designer..

Is this issue already known? How can be this fixed?

Steps to reproduce

Minimal project is attached

DataColumnSerializationIssue.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

💥 regression-releaseRegression from a public releasearea-VSDesignerWindows Forms out-of-proc designer related issuestracking-external-issueAn issue is caused by an external system and won't be fixed in this repo

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions