From 8b9d8c3cf68a9b0c12e631fcb322d79be5460c89 Mon Sep 17 00:00:00 2001 From: Pablo Monteiro Date: Sat, 25 May 2024 15:12:25 -0300 Subject: [PATCH] chore: removing some warnings --- src/Buildalyzer/Buildalyzer.csproj | 6 ++---- src/Buildalyzer/Environment/BuildEnvironment.cs | 2 +- src/Buildalyzer/Logging/EventProcessor.cs | 6 +----- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Buildalyzer/Buildalyzer.csproj b/src/Buildalyzer/Buildalyzer.csproj index 3c8b464a..d1aa8711 100644 --- a/src/Buildalyzer/Buildalyzer.csproj +++ b/src/Buildalyzer/Buildalyzer.csproj @@ -12,12 +12,10 @@ - - - - + + diff --git a/src/Buildalyzer/Environment/BuildEnvironment.cs b/src/Buildalyzer/Environment/BuildEnvironment.cs index 968ed0a9..c877d1f0 100644 --- a/src/Buildalyzer/Environment/BuildEnvironment.cs +++ b/src/Buildalyzer/Environment/BuildEnvironment.cs @@ -76,7 +76,7 @@ public BuildEnvironment( WorkingDirectory = workingDirectory; // Check if we've already specified a path to MSBuild - string envMsBuildExePath = System.Environment.GetEnvironmentVariable(Environment.EnvironmentVariables.MSBUILD_EXE_PATH); + string? envMsBuildExePath = System.Environment.GetEnvironmentVariable(Environment.EnvironmentVariables.MSBUILD_EXE_PATH); MsBuildExePath = !string.IsNullOrEmpty(envMsBuildExePath) && File.Exists(envMsBuildExePath) ? envMsBuildExePath : msBuildExePath; if (string.IsNullOrWhiteSpace(MsBuildExePath) && string.IsNullOrWhiteSpace(dotnetExePath)) diff --git a/src/Buildalyzer/Logging/EventProcessor.cs b/src/Buildalyzer/Logging/EventProcessor.cs index 7a5e3f9d..9ac7ed26 100644 --- a/src/Buildalyzer/Logging/EventProcessor.cs +++ b/src/Buildalyzer/Logging/EventProcessor.cs @@ -1,8 +1,4 @@ extern alias StructuredLogger; - -using System; -using System.Collections.Generic; -using System.Linq; using Microsoft.Build.Framework; using Microsoft.Extensions.Logging; @@ -100,7 +96,7 @@ private void ProjectStarted(object sender, ProjectStartedEventArgs e) // Get the TFM for this project // use an empty string if no target framework was found, for example in case of C++ projects with VS >= 2022 - var tfm = propertiesAndItems?.Properties.TryGet("TargetFrameworkMoniker")?.StringValue + string tfm = propertiesAndItems?.Properties.TryGet("TargetFrameworkMoniker")?.StringValue ?? string.Empty; if (propertiesAndItems != null && propertiesAndItems.Properties != null && propertiesAndItems.Items != null)