From 7c8f813f5bc28c98bab7f7e55982d7497277e8f5 Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Thu, 12 Nov 2020 00:29:43 +0000 Subject: [PATCH 1/2] Enable IDE0041: UseIsNullCheck https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0041 --- .globalconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.globalconfig b/.globalconfig index 32bea9725fd..380436704c5 100644 --- a/.globalconfig +++ b/.globalconfig @@ -848,7 +848,7 @@ dotnet_diagnostic.IDE0039.severity = silent dotnet_diagnostic.IDE0040.severity = warning # IDE0041: UseIsNullCheck -dotnet_diagnostic.IDE0041.severity = silent +dotnet_diagnostic.IDE0041.severity = warning # IDE0042: UseDeconstruction dotnet_diagnostic.IDE0042.severity = silent From b0bc54186dccd98441420f96579b1b3302d72c22 Mon Sep 17 00:00:00 2001 From: xtqqczze Date: Thu, 12 Nov 2020 00:50:20 +0000 Subject: [PATCH 2/2] fixup --- src/System.Management.Automation/engine/MshMemberInfo.cs | 2 +- src/System.Management.Automation/engine/PSVersionInfo.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.Management.Automation/engine/MshMemberInfo.cs b/src/System.Management.Automation/engine/MshMemberInfo.cs index 50d036a1bdd..88379f261d2 100644 --- a/src/System.Management.Automation/engine/MshMemberInfo.cs +++ b/src/System.Management.Automation/engine/MshMemberInfo.cs @@ -1971,7 +1971,7 @@ public bool Equals(PSMethodInvocationConstraints other) public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) + if (obj is null) { return false; } diff --git a/src/System.Management.Automation/engine/PSVersionInfo.cs b/src/System.Management.Automation/engine/PSVersionInfo.cs index 529374a58db..289f105987e 100644 --- a/src/System.Management.Automation/engine/PSVersionInfo.cs +++ b/src/System.Management.Automation/engine/PSVersionInfo.cs @@ -859,7 +859,7 @@ public int CompareTo(object version) /// public int CompareTo(SemanticVersion value) { - if ((object)value == null) + if (value is null) return 1; if (Major != value.Major)