-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix 13247 by removing unnecessary judgment from method Serialize of DemoConsole.DesignerSerializationService #13478
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
Fix 13247 by removing unnecessary judgment from method Serialize of DemoConsole.DesignerSerializationService #13478
Conversation
…heDemoConsole.DesignerSerializationService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes an unnecessary if (obj is Control)
check in the Serialize
method of the test integration for the designer serialization service, allowing all objects in the collection to be serialized rather than only controls.
- Eliminates a type guard that prevented non-
Control
objects from being serialized in tests. - Ensures tool strip items (and other objects) can be round-tripped in designer serialization tests.
Comments suppressed due to low confidence (2)
src/test/integration/DesignSurface/DesignSurfaceExt/DesignerSerializationServiceImpl.cs:35
- [nitpick] Consider adding a brief comment explaining why the
Control
type check was removed, so future readers understand the intentional widening of serialization behavior.
componentSerializationService.Serialize(serializationStore, obj);
src/test/integration/DesignSurface/DesignSurfaceExt/DesignerSerializationServiceImpl.cs:33
- Add a test case that includes non-
Control
objects in theobjects
collection to verify that serialization still succeeds and does not throw unexpected exceptions.
public object Serialize(ICollection objects)
This comment was marked as resolved.
This comment was marked as resolved.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13478 +/- ##
===================================================
+ Coverage 76.59823% 76.59949% +0.00126%
===================================================
Files 3230 3230
Lines 639097 639157 +60
Branches 47289 47295 +6
===================================================
+ Hits 489537 489591 +54
+ Misses 145992 145989 -3
- Partials 3568 3577 +9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Fixes #13247
Cause:
This problem is due to the ToolStripItem not being serialized
Judgment
if (obj is Control)
was added to theSerialize
method of theDemoConsole.DesignerSerializationService
, resulting inToolStripItem
not being serializedwinforms/src/test/integration/DesignSurface/DesignSurfaceExt/DesignerSerializationServiceImpl.cs
Lines 36 to 37 in 716bc12
.netFramwork does not have this logic
Proposed changes
if (obj is Control)
from methodSerialize
ofDemoConsole.DesignerSerializationService
Customer Impact
Regression?
Risk
Screenshots
Before
The subitem of the ToolStrip cannot be copied

After
All of the content can be copied normally

Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow