.NET 8 Upgrade Silenced Errors Fix (#30469)

* [Dev][Build] .NET 8 Upgrade Silenced errors first fix.

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1859

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1854.

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1860

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1861

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1862

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1863

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1864

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1865

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA2208

* [Dev][Build] .NET 8 Upgrade Silenced errors. CS9191

* [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check

* [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check

* [Dev][Build] .NET 8 Upgrade Silenced errors.
- CompositeFormat variables used more than once in the same file were assigned to a single variable.
- GetProcessesByName logic fix.
- String comparion fix.
- ArgumentOutOfRangeException message change.

* [Dev][Build] .NET 8 Upgrade Silenced errors.
- Null check added.
- static readonly CompositeFormat added for all fields.
This commit is contained in:
gokcekantarci
2023-12-28 13:37:13 +03:00
committed by GitHub
parent cd57659ef6
commit a94b3eec39
112 changed files with 429 additions and 291 deletions

View File

@@ -91,7 +91,7 @@ namespace Microsoft.Plugin.Program
.Where(r => r?.Score > 0)
.ToArray();
if (result.Any())
if (result.Length != 0)
{
var maxScore = result.Max(x => x.Score);
return result

View File

@@ -308,7 +308,7 @@ namespace Microsoft.Plugin.Program.Programs
{
parsed = prefix + key;
}
else if (key.StartsWith("/", StringComparison.Ordinal))
else if (key.StartsWith('/'))
{
parsed = prefix + "//" + key;
}

View File

@@ -761,7 +761,7 @@ namespace Microsoft.Plugin.Program.Programs
.ToList() ?? Enumerable.Empty<string>();
// Function to obtain the list of applications, the locations of which have been added to the env variable PATH
private static IEnumerable<string> PathEnvironmentProgramPaths(IList<string> suffixes)
private static List<string> PathEnvironmentProgramPaths(IList<string> suffixes)
{
// To get all the locations stored in the PATH env variable
var pathEnvVariable = Environment.GetEnvironmentVariable("PATH");
@@ -788,7 +788,7 @@ namespace Microsoft.Plugin.Program.Programs
.SelectMany(indexLocation => ProgramPaths(indexLocation, suffixes))
.ToList();
private static IEnumerable<string> StartMenuProgramPaths(IList<string> suffixes)
private static List<string> StartMenuProgramPaths(IList<string> suffixes)
{
var directory1 = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
var directory2 = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu);
@@ -797,7 +797,7 @@ namespace Microsoft.Plugin.Program.Programs
return IndexPath(suffixes, indexLocation);
}
private static IEnumerable<string> DesktopProgramPaths(IList<string> suffixes)
private static List<string> DesktopProgramPaths(IList<string> suffixes)
{
var directory1 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var directory2 = Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory);
@@ -807,7 +807,7 @@ namespace Microsoft.Plugin.Program.Programs
return IndexPath(suffixes, indexLocation);
}
private static IEnumerable<string> RegistryAppProgramPaths(IList<string> suffixes)
private static List<string> RegistryAppProgramPaths(IList<string> suffixes)
{
// https://msdn.microsoft.com/library/windows/desktop/ee872121
const string appPaths = @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths";