Skip to content

fix #13305 Baseline SnapLines do not appear in DesignSurface #13324

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

Merged
merged 1 commit into from
Apr 21, 2025

Conversation

Epica3055
Copy link
Member

@Epica3055 Epica3055 commented Apr 18, 2025

fix #13305

The cause of this issue

This issue is caused by PR10279

These are two of all changes make in PR10279
image

BehaviorService, DragAssistanceManager use SnapLines to add some effects during design time.

ControlDesigner has a virtual property SnapLines, but most designers override the property, in other words, most designers have customized SnapLines

Code flow before PR10279

when BehaviorService or DragAssistanceManager accesses SnapLines , customized SnapLines were returned.

Code flow after PR10279

ControlDesigner.cs

image

when BehaviorService or DragAssistanceManager accesses SnapLinesInternal , customized SnapLines were skipped.

Proposed changes

  • Use SnapLines

Screenshots

Before

Image

After

Image

Test methodology

  • manually

Copy link

codecov bot commented Apr 18, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 62.58290%. Comparing base (88c3a11) to head (4ebcd6a).
Report is 171 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13324         +/-   ##
===================================================
+ Coverage   61.34314%   62.58290%   +1.23976%     
===================================================
  Files           1547        1560         +13     
  Lines         158479      159689       +1210     
  Branches       14751       14906        +155     
===================================================
+ Hits           97216       99938       +2722     
+ Misses         60561       58983       -1578     
- Partials         702         768         +66     
Flag Coverage Δ
Debug 62.58290% <50.00000%> (-12.58918%) ⬇️
integration 11.32692% <50.00000%> (-7.54506%) ⬇️
production 40.77283% <50.00000%> (-34.39925%) ⬇️
test 95.69057% <ø> (∅)
unit 38.15207% <0.00000%> (-36.10495%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@LeafShi1 LeafShi1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Tanya-Solyanik
Copy link
Contributor

Nice investigation!
Please add a test where a test custom designer derived from the ControlDesigner class, modifies the overridden SnapLines collection and this collection can be correctly accessed vis the base class virtual property ControlDesigner.Snaplines.

Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, please add unit test.

@Tanya-Solyanik Tanya-Solyanik added the waiting-author-feedback The team requires more information from the author label Apr 18, 2025
@Epica3055
Copy link
Member Author

Epica3055 commented Apr 21, 2025

@Tanya-Solyanik
We already have tests for snaplines in SnapLineTests.cs , and in specific designers like LabelDesigner.cs

Besides, I think the root of this issue resides with the misuse of property (SnapLinesInternal for SnapLines)

@Tanya-Solyanik
Copy link
Contributor

Tanya-Solyanik commented Apr 21, 2025

Besides, I think the root of this issue resides with the misuse of property (SnapLinesInternal for SnapLines)

Yes, could you please add a test for the rootcause - a test that ensures that the virtual method is called. I'll merger this PR to include this fix in the next preview, but please add a test in the next PR.

@Tanya-Solyanik Tanya-Solyanik merged commit 7098151 into dotnet:main Apr 21, 2025
9 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview4 milestone Apr 21, 2025
@Epica3055
Copy link
Member Author

/backport to release/9.0

Copy link
Contributor

Started backporting to release/9.0: https://github.com/dotnet/winforms/actions/runs/14608188769

Tanya-Solyanik added a commit that referenced this pull request May 8, 2025
…rface (#13349)

Backport of #13324 to release/9.0



## The cause of this issue
This issue is caused by
[PR10279](#10279)

These are two of all changes make in
[PR10279](#10279)

![image](https://github.com/user-attachments/assets/155740a9-6e1e-4a7c-8581-9d813b1d149b)

`BehaviorService`, `DragAssistanceManager` use `SnapLines` to add some
effects during design time.


`ControlDesigner` has a **_virtual_** property `SnapLines`, but most
designers override the property, in other words, _**most designers have
customized `SnapLines`**_

### Code flow before
[PR10279](#10279)

when `BehaviorService` or `DragAssistanceManager` accesses `SnapLines` ,
customized `SnapLines` were returned.

### Code flow after
[PR10279](#10279)

when `BehaviorService` or `DragAssistanceManager` **_accesses
`SnapLinesInternal`_** , **_customized `SnapLines` were skipped._**

## Proposed changes

- 
- Use `SnapLines`
- 


<!-- 
## Customer Impact

- 
- 

## Regression? 

- Yes / No

## Risk

-
 -->


## Screenshots 

### Before


![Image](https://github.com/user-attachments/assets/5650c5d5-8433-4b5e-8723-806867186be2)

### After


![Image](https://github.com/user-attachments/assets/4c528e07-39a9-497b-86d8-3f450f6e634b)



## Test methodology 

- 
- manually 
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DesignerSupport waiting-author-feedback The team requires more information from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Baseline SnapLines do not appear in DesignSurface
3 participants