Possible incorrect use of "NOT ... OR ..." pattern
Our internal tools are flagging these blocks of code as potentially improper use of the not ... or ... pattern matching syntax.
https://github.com/dotnet/winforms/blob/2f677f9560b5258212c721c17f1e8803581608d7/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/ByteViewer.cs#L173-L177
See https://github.com/dotnet/roslyn/issues/75506 for more information on why this pattern is being flagged. If this logic is correct, consider restructuring it to use clarifying () parentheses.
Yes, Based on the behavior of the control. I think the logic here is incorrect.
@Olina-Zhang Could your team please have a look?
If adding parentheses, the logic will be different from the original.
@merriemcgaw @Shyam-Gupta This issue also exists in the VS repository. Should we change it as well?
https://devdiv.visualstudio.com/DevDiv/_git/VS?path=/src/vsip/Designer/CompMod/System/ComponentModel/Design/ByteViewer.cs&version=GBmain&line=221&lineEnd=226&lineStartColumn=8&lineEndColumn=10&lineStyle=plain&_a=contents
@LeafShi1 can you work through the code and determine if this is indeed incorrect logic for the control and if so, please update it in both places.
The fix https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/690988 in VS repo
Our internal tools are flagging these blocks of code as potentially improper use
Hey @LeafShi1,
before we tackle and change this: This has likely be refactored at some point. If that's the case, could you find the PR which did that, so we can take a look at the original code?
If that's true also for the code in VS you have in mind, let's also find the refactoring PR for that, if it exists.
Thanks!
@KlausLoeffelmann This file ByteViewer.cs was added in .NET 3.1 Initially, it was written
https://github.com/dotnet/winforms/blob/b0c8fe5cfc8848b8e13e15cfe4a5b21c40f5a3cd/src/System.Windows.Forms.Design/src/System/ComponentModel/Design/ByteViewer.cs#L193-L198
(consistent with the code in the .NET Framework). Later, it was changed to its current form in https://github.com/dotnet/winforms/pull/11050, but the logic remained unchanged throughout.
VSRepo contains only one history entry from 2017. The .NET Framework code dates back to D11Rel, but has not been refactored.