Navigation Menu

Skip to content

Commit

Permalink
fix: suppress PlatformNotSupportedException on Xamarin of macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
natemcmaster committed Mar 11, 2020
1 parent 294a829 commit f3a4725
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/CommandLineUtils/IO/PhysicalConsole.cs
Expand Up @@ -27,7 +27,18 @@ private PhysicalConsole()
public event ConsoleCancelEventHandler? CancelKeyPress
{
add => Console.CancelKeyPress += value;
remove => Console.CancelKeyPress -= value;
remove
{
try
{
Console.CancelKeyPress -= value;
}
catch (PlatformNotSupportedException)
{
// https://github.com/natemcmaster/CommandLineUtils/issues/344
// Suppress this error during unsubscription on some Xamarin platforms.
}
}
}

/// <summary>
Expand Down

0 comments on commit f3a4725

Please sign in to comment.