From ea5f216b1f1b33d979bbf51d7bc591b57cbcd531 Mon Sep 17 00:00:00 2001 From: Slendy Date: Sat, 24 Sep 2022 20:00:02 -0500 Subject: [PATCH] Fix unreachable code warnings --- .../Pages/Layouts/BaseLayout.cshtml | 8 ++------ .../Pages/RegisterForm.cshtml | 2 +- ProjectLighthouse/Configuration/ServerStatics.cs | 13 ++++++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml b/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml index cad582bc..07126167 100644 --- a/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/Layouts/BaseLayout.cshtml @@ -144,9 +144,7 @@ - @* ReSharper disable HeuristicUnreachableCode *@ - @* ReSharper disable CSharpWarnings::CS0162 *@ - @if (!ServerStatics.IsDebug && VersionHelper.IsDirty) + @if (!ServerStatics.IsDebug() && VersionHelper.IsDirty) {
@@ -166,8 +164,6 @@
} - @* ReSharper restore CSharpWarnings::CS0162 *@ - @* ReSharper restore HeuristicUnreachableCode *@
@@ -197,7 +193,7 @@ }
- @if (ServerStatics.IsDebug) + @if (ServerStatics.IsDebug()) {
diff --git a/ProjectLighthouse.Servers.Website/Pages/RegisterForm.cshtml b/ProjectLighthouse.Servers.Website/Pages/RegisterForm.cshtml index 53a4c151..46ebd31a 100644 --- a/ProjectLighthouse.Servers.Website/Pages/RegisterForm.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/RegisterForm.cshtml @@ -85,7 +85,7 @@

-@if (ServerStatics.IsDebug) +@if (ServerStatics.IsDebug()) { diff --git a/ProjectLighthouse/Configuration/ServerStatics.cs b/ProjectLighthouse/Configuration/ServerStatics.cs index 8e87417d..923a4ced 100644 --- a/ProjectLighthouse/Configuration/ServerStatics.cs +++ b/ProjectLighthouse/Configuration/ServerStatics.cs @@ -27,11 +27,14 @@ public static class ServerStatics // FIXME: This needs to go at some point. public static bool IsUnitTesting => AppDomain.CurrentDomain.GetAssemblies().Any(assembly => assembly.FullName!.StartsWith("xunit")); - #if DEBUG - public const bool IsDebug = true; - #else - public const bool IsDebug = false; - #endif + public static bool IsDebug() + { + #if DEBUG + return true; + #else + return false; + #endif + } /// /// The servertype, determined on startup. Shouldn't be null unless very very early in startup.