-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Possibly wrong pattern match in VirtualizingStackPanel.GetControl
#15955
Labels
Comments
It is wrong, you are correct. if (count == 0 ||
- fromControl is null && direction is not NavigationDirection.First or NavigationDirection.Last)
+ (fromControl is null && direction != NavigationDirection.First && direction != NavigationDirection.Last) |
@jnyrup maybe you can file a PR with the fix? 🙏 thx |
Unfortunately I don't have the time to do this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In C# the pattern
x is not A or B
is interpreted asx is (not A) or B
and notx is not (A or B)
.I was grep'ing my local git repositories for code that matched and stumbled upon
Avalonia/src/Avalonia.Controls/VirtualizingStackPanel.cs
Line 284 in 82e3613
So this code is not checking whether
direction
is "neitherFirst
norLast
".As
Last
is covered bynot First
Roslyn even lowers this to!= First
.As such this looks like a bug to me
SharpLab
To Reproduce
I found this by analyzing the code and didn't write any code I don't know and haven't looked into if this potential bug can be hit.
Expected behavior
No response
Avalonia version
master
OS
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: