You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromControlisnull&&directionis not NavigationDirection.First or NavigationDirection.Last)
So this code is not checking whether direction is "neitherFirstnorLast".
As Last is covered by not First Roslyn even lowers this to != First.
As such this looks like a bug to me
It is wrong, you are correct.
Whole condition should be changed from
if (count == 0 ||
- fromControl is null && direction is not NavigationDirection.First or NavigationDirection.Last)+ (fromControl is null && direction != NavigationDirection.First && direction != NavigationDirection.Last)
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: