Skip to content

Conversation

@JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Aug 18, 2019

The bug was introduced as part of refactoring in #1034 - ordering got flipped with switching as to is.
The confusion was likely caused by the fact that the property setter called its own getter.

Update the code to be more explicit in terminology to hopefully avoid this from happening again.

Fixes #1311
Fixes #1520
Fixes #1607
Fixes #1644

Proposed changes

  • Properly add message reflect children

Customer Impact

  • Without this NO messages will be sent to child controls- this impacts a huge swath of functionality

Regression?

Risk

  • Low

Test methodology

  • Extensive debugging, ran automated and manual tests

Test environment(s)

Host (useful for support):
Version: 3.0.0-preview8-28405-07
Commit: d01b2fb7bc

Microsoft Reviewers: Open in CodeFlow

@JeremyKuhne JeremyKuhne added 🪲 bug Product bug (most likely) ask-mode labels Aug 18, 2019
@JeremyKuhne JeremyKuhne added this to the 3.0.0-Preview9 milestone Aug 18, 2019
@JeremyKuhne JeremyKuhne requested a review from a team as a code owner August 18, 2019 17:31
@JeremyKuhne
Copy link
Member Author

I'll look to see what sort of automated tests can be added for this when I recover from investigating the issue. 😴

@RussKie
Copy link
Contributor

RussKie commented Aug 19, 2019

Thank you Jeremy!

#1034 in commit 462c242 made the following change:

@@ -3803,9 +3801,8 @@ namespace System.Windows.Forms
                     value.AddReflectChild();
                 }
 
-                Control c = ReflectParent as Control;
                 reflectParent = value;
-                if (c != null)
+                if (ReflectParent is Control c)
                 {
                     c.RemoveReflectChild();
                 }

The orginal code that come from .NET Fx:

                Control c = ReflectParent as Control;
                reflectParent = value;
                if (c != null) {
                    c.RemoveReflectChild();
                }

A significance of the order of instructions isn't particularly obvious.
The fact that a backing field and the property are liberally interchanged without any obiovus reason is concerning.

@RussKie RussKie added waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) and removed ask-mode labels Aug 19, 2019
@codecov
Copy link

codecov bot commented Aug 19, 2019

Codecov Report

Merging #1661 into master will decrease coverage by 0.04871%.
The diff coverage is 100%.

@@                 Coverage Diff                 @@
##              master       #1661         +/-   ##
===================================================
- Coverage   25.93581%   25.88709%   -0.04872%     
===================================================
  Files            807         807                 
  Lines         267788      267786          -2     
  Branches       37960       37960                 
===================================================
- Hits           69453       69322        -131     
- Misses        193404      193526        +122     
- Partials        4931        4938          +7
Flag Coverage Δ
#Debug 25.88709% <100%> (-0.04872%) ⬇️
#production 25.88709% <100%> (-0.04872%) ⬇️
#test 100% <ø> (ø) ⬆️

@RussKie
Copy link
Contributor

RussKie commented Aug 19, 2019

I've enhanced our manual integration tests and reworded the commit message (hope you don't mind).

💭 I wonder if we can enhance our integration tests to perform actions (like change selected item in a combo) and assert a label has the expected text?
No sure how we can deal with message boxes though, probably remove them altogether...

@RussKie RussKie added ask-mode and removed waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) labels Aug 20, 2019
Fixes dotnet#1311
Fixes dotnet#1520
Fixes dotnet#1607
Fixes dotnet#1644

The bug was introduced as part of refactoring in dotnet#1034 - ordering got flipped with switching `as` to `is`.
The confusion was likely caused by the fact that the property setter called its own getter.

Update the code to be more explicit in terminology to hopefully avoid this from happening again.
@RussKie
Copy link
Contributor

RussKie commented Aug 20, 2019

Added more manual tests for richtextboxes

@weltkante
Copy link
Contributor

weltkante commented Aug 20, 2019

Does this actually fix #1520 as claimed in PR description? There was a stackoverflow article linked in #1631 (resolved duplicate of #1520) which explains "friendly name hyperlinks" as a feature being added in RTF 5.0 and WinForms never being updated to support it. From that description it doesn't sound like being cause by this particular regression, since it already regressed in Desktop Framework long before. If #1520 is solved by this PR then #1631 might need to be revisisted.

@RussKie
Copy link
Contributor

RussKie commented Aug 20, 2019

Does this actually fix #1520 as claimed in PR description?

It does.
Please see WinformsControlsTest/RichTextBoxes test example.

@weltkante
Copy link
Contributor

weltkante commented Aug 20, 2019

I see, I'd recommend to reopen/unduplicate #1631 then because it probably doesn't get fixed by this PR (can't test easily at the moment, but I added an example to the issue)

@leecow
Copy link
Member

leecow commented Aug 20, 2019

tactics approved - preview 9

@RussKie RussKie merged commit bf1631f into dotnet:master Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🪲 bug Product bug (most likely)

Projects

None yet

5 participants