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
{{ message }}
Repository navigation
Replace == null and != null with is null and is not null #3459
You might want to fill out your template in the PR #3469
Also it would be good to get confirmation that potential precedence changes between == and is operators do not have edge cases that require adding braces.
@elachlan regarding _priorWindowProcHandle, it looks to me like void*can use is null, so the analyzer suggesting using is null syntax doesn't appear to be a mistake. Or are you saying that the analyzer didn't pick up on it and you think it should?
Activity
sashatankov commentedon Jun 17, 2020
Hey, I'd like to work on this one
RussKie commentedon Jun 17, 2020
Awesome! Let's do it gradually, per project, to reduce churn and conflicts.
sashatankov commentedon Jun 18, 2020
Do you want me to do any particular project? if not, then I randomly choose one
weltkante commentedon Jun 18, 2020
You might want to fill out your template in the PR #3469
Also it would be good to get confirmation that potential precedence changes between
==andisoperators do not have edge cases that require adding braces.RussKie commentedon Jun 19, 2020
No preference on a project, but
== null->is nullfor now until C# 9.0 is generally available.Youssef1313 commentedon Sep 2, 2020
@RussKie A regex search in the whole repo with
==\s*nullshows only 3 results. Two of them are comments, and one is an assertion message string.Edit: It seems like the repo is using
null == x, notx == null. That's why my Regex failed.There are a few occurrences with the following regex:
null\s*==. I opened #3825 for some occurrences.Use 'is not null' in some System.Windows.Forms.Design files (#6083)
Use 'is not null' in some System.Windows.Forms.Design files (#6086)
Use 'is not null' in some System.Windows.Forms files (#6112)
elachlan commentedon Oct 23, 2022
@Youssef1313 do you know of an analyzer that handles this?
Youssef1313 commentedon Oct 24, 2022
@elachlan On Roslyn side, there is an open request for it in dotnet/roslyn#56859. There is https://github.com/AArnott/CSharpIsNull though.
elachlan commentedon Oct 24, 2022
@RussKie is the winforms team comfortable using the analyzer written by @AArnott at https://github.com/AArnott/CSharpIsNull?
RussKie commentedon Oct 24, 2022
Yes, we know where to find him :)
As a matter of fact we already using another package of his:
winforms/eng/Versions.props
Line 70 in 9538742
elachlan commentedon Nov 16, 2022
CSharpIsNull has landed in winforms. So anyone wanting to refactor, it should now be a lot easier.
elachlan commentedon Nov 22, 2022
@AArnott is this a false negative?
_priorWindowProcHandleis avoid*.winforms/src/System.Windows.Forms/src/System/Windows/Forms/NativeWindow.cs
Line 513 in be03f45
Also
ppRetValOutis anIntPtr*and has an== nullwinforms/src/System.Windows.Forms/src/System/Windows/Forms/AccessibleObject.cs
Lines 757 to 762 in be03f45
AArnott commentedon Nov 22, 2022
@elachlan regarding
_priorWindowProcHandle, it looks to me likevoid*can useis null, so the analyzer suggesting usingis nullsyntax doesn't appear to be a mistake. Or are you saying that the analyzer didn't pick up on it and you think it should?Same observation/question for the second. I guess the confusion is what you mean by a false negative. If you mean no warning is produced and you think there should be, can you file a bug at https://github.com/AArnott/CSharpIsNull/issues?
elachlan commentedon Nov 22, 2022
No warning is produced. I'll file a bug. Thanks :)
elachlan commentedon Nov 22, 2022
The issue I filed: AArnott/CSharpIsNull#30