Skip to content

Commit bb36b93

Browse files
authored
Suppress build.csproj warnings and CS0162 (#4411)
1 parent 0248a90 commit bb36b93

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

build/Build.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
<PackageReference Include="Newtonsoft.Json" />
1111
</ItemGroup>
1212

13-
<!-- setting directly to false as this project will be deprecated soon -->
13+
<!-- suppress all warnings as this project will be deprecated soon -->
1414
<PropertyGroup>
15+
<NoWarn>$(NoWarn);NETSDK1138;NU1903;IDE1006;* </NoWarn>
16+
<WarningLevel>0</WarningLevel>
1517
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
1618
</PropertyGroup>
1719
</Project>

src/Cli/func/Helpers/TelemetryHelpers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public static void UpdateTelemetryEvent(TelemetryEvent telemetryEvent, IDictiona
5151
}
5252
}
5353

54+
#pragma warning disable CS0162 // Unreachable code: TelemetryInstrumentationKey is set during build/CI
5455
public static bool CheckIfTelemetryEnabled()
5556
{
5657
// If Ikey is not set, can't get anything
@@ -60,7 +61,6 @@ public static bool CheckIfTelemetryEnabled()
6061
return false;
6162
}
6263

63-
#pragma warning disable 0162
6464
// If opt out is not set, we check if the default sentinel is present
6565
var optOutVar = Environment.GetEnvironmentVariable(Constants.TelemetryOptOutVariable);
6666
if (string.IsNullOrEmpty(optOutVar))
@@ -72,6 +72,7 @@ public static bool CheckIfTelemetryEnabled()
7272
// If opt out is present and set to falsy, only then we enable telemetry
7373
return optOutVar == "0" || optOutVar.Equals("false", StringComparison.OrdinalIgnoreCase);
7474
}
75+
#pragma warning restore CS0162 // Unreachable code
7576

7677
public static void LogEventIfAllowedSafe(ITelemetry telemetry, TelemetryEvent telemetryEvent)
7778
{

0 commit comments

Comments
 (0)