diff --git a/Terminal.Gui/Configuration/ConfigurationManager.cs b/Terminal.Gui/Configuration/ConfigurationManager.cs index 2dbd2ba44..1731c9556 100644 --- a/Terminal.Gui/Configuration/ConfigurationManager.cs +++ b/Terminal.Gui/Configuration/ConfigurationManager.cs @@ -82,8 +82,10 @@ public static class ConfigurationManager /// to get and set the property's value. /// /// Is until is called. + [System.Diagnostics.CodeAnalysis.SuppressMessage ("Style", "IDE1006:Naming Styles", Justification = "")] internal static Dictionary? _allConfigProperties; + [System.Diagnostics.CodeAnalysis.SuppressMessage ("Style", "IDE1006:Naming Styles", Justification = "")] internal static readonly JsonSerializerOptions _serializerOptions = new () { ReadCommentHandling = JsonCommentHandling.Skip, @@ -104,8 +106,10 @@ public static class ConfigurationManager Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; - internal static StringBuilder jsonErrors = new (); + [System.Diagnostics.CodeAnalysis.SuppressMessage ("Style", "IDE1006:Naming Styles", Justification = "")] + internal static StringBuilder _jsonErrors = new (); + [System.Diagnostics.CodeAnalysis.SuppressMessage ("Style", "IDE1006:Naming Styles", Justification = "")] private static readonly string _configFilename = "config.json"; /// The backing property for . @@ -300,12 +304,12 @@ public static class ConfigurationManager /// Prints any Json deserialization errors that occurred during deserialization to the console. public static void PrintJsonErrors () { - if (jsonErrors.Length > 0) + if (_jsonErrors.Length > 0) { Console.WriteLine ( @"Terminal.Gui ConfigurationManager encountered the following errors while deserializing configuration files:" ); - Console.WriteLine (jsonErrors.ToString ()); + Console.WriteLine (_jsonErrors.ToString ()); } } @@ -350,7 +354,7 @@ public static class ConfigurationManager internal static void AddJsonError (string error) { Debug.WriteLine ($"ConfigurationManager: {error}"); - jsonErrors.AppendLine (error); + _jsonErrors.AppendLine (error); } /// @@ -602,5 +606,5 @@ public static class ConfigurationManager return stream; } - private static void ClearJsonErrors () { jsonErrors.Clear (); } + private static void ClearJsonErrors () { _jsonErrors.Clear (); } } diff --git a/Terminal.sln.DotSettings b/Terminal.sln.DotSettings index ef874a7ca..d04aeb7c3 100644 --- a/Terminal.sln.DotSettings +++ b/Terminal.sln.DotSettings @@ -383,6 +383,9 @@ True True False + <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> True True True diff --git a/UnitTests/Configuration/ConfigurationMangerTests.cs b/UnitTests/Configuration/ConfigurationMangerTests.cs index c238ad5fb..d2c96b341 100644 --- a/UnitTests/Configuration/ConfigurationMangerTests.cs +++ b/UnitTests/Configuration/ConfigurationMangerTests.cs @@ -41,6 +41,7 @@ public class ConfigurationManagerTests Assert.True (fired); Applied -= ConfigurationManager_Applied; + Reset (); } [Fact] @@ -176,6 +177,7 @@ public class ConfigurationManagerTests Assert.True (fired); Updated -= ConfigurationManager_Updated; + Reset (); } [Fact] @@ -264,6 +266,7 @@ public class ConfigurationManagerTests Assert.Equal (KeyCode.PageDown | KeyCode.CtrlMask, Application.AlternateForwardKey.KeyCode); Assert.Equal (KeyCode.PageUp | KeyCode.CtrlMask, Application.AlternateBackwardKey.KeyCode); Assert.False (Application.IsMouseDisabled); + Reset (); } [Fact] @@ -537,7 +540,7 @@ public class ConfigurationManagerTests Settings.Update ("{}}", "test"); - Assert.NotEqual (0, jsonErrors.Length); + Assert.NotEqual (0, _jsonErrors.Length); Application.Shutdown (); @@ -630,7 +633,7 @@ public class ConfigurationManagerTests jsonException = Assert.Throws (() => Settings.Update (json, "test")); Assert.StartsWith ("Unknown property", jsonException.Message); - Assert.Equal (0, jsonErrors.Length); + Assert.Equal (0, _jsonErrors.Length); ThrowOnJsonErrors = false; } @@ -813,6 +816,7 @@ public class ConfigurationManagerTests Assert.Equal (new Color (Color.White), Colors.ColorSchemes ["Base"].Normal.Foreground); Assert.Equal (new Color (Color.Blue), Colors.ColorSchemes ["Base"].Normal.Background); + Reset (); } [Fact] diff --git a/UnitTests/Configuration/ThemeScopeTests.cs b/UnitTests/Configuration/ThemeScopeTests.cs index 900676c5a..3da7f881a 100644 --- a/UnitTests/Configuration/ThemeScopeTests.cs +++ b/UnitTests/Configuration/ThemeScopeTests.cs @@ -35,6 +35,7 @@ public class ThemeScopeTests ThemeManager.Themes! [ThemeManager.SelectedTheme]!.Apply (); Assert.Equal (Dialog.ButtonAlignments.Right, Dialog.DefaultButtonAlignment); + Reset (); } [Fact]