Closed Junjun-zhao closed 1 month ago
@merriemcgaw Could you please take a look at this issue? There are 5 apps affected in our lab.
CC: @richaverma1 @PriyaPurkayastha @marklio for awareness.
Adding @KlausLoeffelmann per chat with @merriemcgaw. Also cc @gewarren since customer created an issue for missing doc linked above. @KlausLoeffelmann is this an intentional breaking change (the analyzer work done as part of binary formatter removal) that hasn't been documented? Can you please create a breaking change issue for this using the template https://github.com/dotnet/docs/issues/new?assignees=gewarren&labels=breaking-change%2CPri1%2Cdoc-idea&projects=&template=02-breaking-change.yml&title=%5BBreaking+change%5D%3A+
Also adding @JeremyKuhne as requested by @merriemcgaw
This is by design, introduced with .NET 9 (RC1). We need to make sure for security reasons, that properties for WinForms Designer are not serialized by accident.
We will follow up with a respective Blog Post shortly.
In the meanwhile, please fix the CodeDOM Serialization configuration for properties according to WinForms best practices:
DesignerSerializationVisibilityAttribute
ORDefaultValueAttribute
ORprivate bool ShouldSerialize[Property]
method, which controls the serialization at Design Time.@KlausLoeffelmann thanks for confirming. However, our breaking change process for .NET is that whenever we introduce a breaking change, it has to be accompanied by a breaking change doc in the very same release so that customers that start using the new release are not taken by surprise (like we saw with this change where two customers as well as .NET AppCompat lab did not know to expect this). Request you to kindly create the breaking change doc issue using the template provided above immediately. The blog post will definitely help everyone but does not substitute the breaking change documentation.
OK, yes, that makes sense!
I created this and will make sure the blog post will be out ASAP! (It's almost done, so, no problem).
https://github.com/dotnet/docs/issues/42724
@JeremyKuhne, @merriemcgaw.
@KlausLoeffelmann I think it would be helpful to point out default behaviour:
Members that do not have a DesignerSerializationVisibilityAttribute will be treated as though they have a DesignerSerializationVisibilityAttribute with a value of Visible. The values of a property marked as Visible will be serialized, if possible, by a serializer for the type.
@KlausLoeffelmann Thank you for creating the breaking change doc quickly. Could you please close this issue? Thanks.
.NET version
Dotnet Info:
Did it work in .NET Framework?
Not tested/verified
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Yes
Verify Scenarios: 1). Windows 10 21H2 AMD64 + dotnet-sdk-8.0.300(default target net8.0): Pass 2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-rc.2.24470.13(default target net8.0): Pass 3). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-rc.2.24470.13(retarget net9.0): Fail 4). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-rc.1.24452.12(retarget net9.0): Fail 5). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.7.24407.12(retarget net9.0): Pass
Issue description
When retarget the 3rd party application to net9.0 and build with the latest .NET 9 sdk, it failed with error:
Property 'CellTemplate' does not configure the code serialization for its property content
.Application Name: WinformsSamples, mRemoteNG, Character-Builder-5, AutoVersionsDB,HeroesPowerPlant OS: Windows 10 21H2 CPU: X64 .NET Build Number: dotnet-sdk-9.0.100-rc.2.24470.13 App & Source checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2260303 Github Link: GitHub - dotnet/samples: Sample code referenced by the .NET documentation
Steps to reproduce
App Repro Steps:(dotnet-sdk-9.0.100-rc.2.24470.13 installed) 1.Retarget app to net9.0 in \WinformsAPP\datagridview\CSWinFormDataGridView\CSWinFormDataGridView.csproj
Expected Result: Build successfully.
Actual Result: Build failed with error:
WFO1000: Property 'CellTemplate' does not configure the code serialization for its property content
.Minimal Repro Steps (Demo attached:WinformsDemo.zip):
Expected Result: Build successfully.
Actual Result: Build failed with error: Property 'Test' does not configure the code serialization for its property content.
Findings: There is a similar issue filed on github: DesignerSerializationVisibility - Behaviour Changes · Issue #41964 · dotnet/docs (github.com) This issue starts from .NET 9 RC1 release and if we use the workaround mentioned in above issue to add DesignerSerializationVisibility to property, error will go. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
@dotnet-actwx-bot @dotnet/compat