Skip to content

Commit 6992e9b

Browse files
committed
cleanup: fix compiler errors with latest version of C# 8 compiler
1 parent 95cf6bf commit 6992e9b

File tree

8 files changed

+8
-7
lines changed

8 files changed

+8
-7
lines changed

src/CommandLineUtils/IO/IConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface IConsole
1515
/// <summary>
1616
/// Raised when Ctrl+C is pressed.
1717
/// </summary>
18-
event ConsoleCancelEventHandler CancelKeyPress;
18+
event ConsoleCancelEventHandler? CancelKeyPress;
1919

2020
/// <summary>
2121
/// stdout

src/CommandLineUtils/IO/NullConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private NullConsole()
6161
/// <summary>
6262
/// This event never fires.
6363
/// </summary>
64-
public event ConsoleCancelEventHandler CancelKeyPress
64+
public event ConsoleCancelEventHandler? CancelKeyPress
6565
{
6666
add { }
6767
remove { }

src/CommandLineUtils/IO/PhysicalConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class PhysicalConsole : IConsole
2626
/// <summary>
2727
/// <see cref="Console.CancelKeyPress"/>.
2828
/// </summary>
29-
public event ConsoleCancelEventHandler CancelKeyPress
29+
public event ConsoleCancelEventHandler? CancelKeyPress
3030
{
3131
add => Console.CancelKeyPress += value;
3232
remove => Console.CancelKeyPress -= value;

src/CommandLineUtils/McMaster.Extensions.CommandLineUtils.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ McMaster.Extensions.CommandLineUtils.ArgumentEscaper
2525
A community-maintained fork of Microsoft.Extensions.CommandLineUtils, plus many enhancements.
2626
</PackageDescription>
2727
<PackageTags>commandline;parsing</PackageTags>
28+
<WarningsNotAsErrors>8602;8603;8604;$(WarningsNotAsErrors)</WarningsNotAsErrors>
2829
</PropertyGroup>
2930

3031
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">

test/CommandLineUtils.Tests/OptionAttributeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public int Value
203203
public static int StaticNumber { get; private set; }
204204

205205
[Option("--static-string")]
206-
public static string StaticString { get; }
206+
public static string? StaticString { get; }
207207

208208
[Option("--static-value")]
209209
public static int StaticValue

test/CommandLineUtils.Tests/Utilities/TestConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public TestConsole(ITestOutputHelper output)
3030
public ConsoleColor ForegroundColor { get; set; }
3131
public ConsoleColor BackgroundColor { get; set; }
3232

33-
public event ConsoleCancelEventHandler CancelKeyPress;
33+
public event ConsoleCancelEventHandler? CancelKeyPress;
3434

3535
public void ResetColor()
3636
{

test/CommandLineUtils.Tests/ValueParserProviderCustomTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private class ComplexTupleParser : IValueParser
3838
return default(ValueTuple<int, double, string>?);
3939
}
4040

41-
var fragments = value.Split('=');
41+
var fragments = value!.Split('=');
4242

4343
try
4444
{

test/Hosting.CommandLine.Tests/Utilities/TestConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public TestConsole(ITestOutputHelper output)
3131
public ConsoleColor ForegroundColor { get; set; }
3232
public ConsoleColor BackgroundColor { get; set; }
3333

34-
public event ConsoleCancelEventHandler CancelKeyPress
34+
public event ConsoleCancelEventHandler? CancelKeyPress
3535
{
3636
add { }
3737
remove { }

0 commit comments

Comments
 (0)