Skip to content

Commit 72c001f

Browse files
authored
Fix for WSL (#60)
1 parent 49e964f commit 72c001f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/NClap/ConsoleInput/BasicConsole.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,11 @@ internal class BasicConsole : IConsoleInput, IConsoleOutput
6565

6666
private readonly PropertyWithSimulatedFallback<ConsoleColor> _foregroundColor = CreateProperty(
6767
() => Console.ForegroundColor, value => Console.ForegroundColor = value,
68-
_defaultForegroundColor,
69-
color => color >= ConsoleColor.Black && color <= ConsoleColor.White);
68+
_defaultForegroundColor);
7069

7170
private readonly PropertyWithSimulatedFallback<ConsoleColor> _backgroundColor = CreateProperty(
7271
() => Console.BackgroundColor, value => Console.BackgroundColor = value,
73-
_defaultBackgroundColor,
74-
color => color >= ConsoleColor.Black && color <= ConsoleColor.White);
72+
_defaultBackgroundColor);
7573

7674
private readonly PropertyWithSimulatedFallback<bool> _treatControlCAsInput = CreateProperty(
7775
() => Console.TreatControlCAsInput, value => Console.TreatControlCAsInput = value,

src/NClap/Utilities/PropertyWithSimulatedFallback`1.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public PropertyWithSimulatedFallback(
4646
// Make sure the initial fallback value passes validation.
4747
if (!this._fallbackValidator(initialFallbackValue))
4848
{
49-
throw new ArgumentOutOfRangeException(nameof(initialFallbackValue));
49+
throw new ArgumentOutOfRangeException(nameof(initialFallbackValue), $"Tried to set value to '{initialFallbackValue}', but failed validation.");
5050
}
5151
}
5252

@@ -72,7 +72,7 @@ public T Value
7272
// First validate the incoming value.
7373
if (!_fallbackValidator(value))
7474
{
75-
throw new ArgumentOutOfRangeException(nameof(value));
75+
throw new ArgumentOutOfRangeException(nameof(value), $"Tried to set value to '{value}', but failed validation.");
7676
}
7777

7878
try

0 commit comments

Comments
 (0)