[PTRun][Registry] Enable analyzer and fix warnings (#16941)

This commit is contained in:
CleanCodeDeveloper
2022-03-10 16:59:04 +01:00
committed by GitHub
parent b1b1f1ba21
commit 94391775c8
3 changed files with 4 additions and 2 deletions

View File

@@ -167,7 +167,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
continue; continue;
} }
if (string.Equals(subKey, searchSubKey, StringComparison.InvariantCultureIgnoreCase)) if (string.Equals(subKey, searchSubKey, StringComparison.OrdinalIgnoreCase))
{ {
var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree); var key = parentKey.OpenSubKey(subKey, RegistryKeyPermissionCheck.ReadSubTree);
if (key != null) if (key != null)

View File

@@ -27,7 +27,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
if (unformattedValue == null) if (unformattedValue == null)
{ {
throw new NullReferenceException(nameof(unformattedValue)); throw new InvalidOperationException($"Cannot proceed when {nameof(unformattedValue)} is null.");
} }
var valueData = key.GetValueKind(valueName) switch var valueData = key.GetValueKind(valueName) switch

View File

@@ -11,6 +11,8 @@
<NeutralLanguage>en-US</NeutralLanguage> <NeutralLanguage>en-US</NeutralLanguage>
<LangVersion>8.0</LangVersion> <LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">