Skip to content

Instantly share code, notes, and snippets.

@filipnavara
Created April 23, 2020 10:08
Show Gist options
  • Save filipnavara/b1a13014d10ca280259a90f75eb4babc to your computer and use it in GitHub Desktop.
Save filipnavara/b1a13014d10ca280259a90f75eb4babc to your computer and use it in GitHub Desktop.
using System;
public class C
{
public static bool ThirdPartyBuggyFunction(string randomParameter)
{
try
{
return randomParameter[0] == '/';
}
catch (Exception e)
{
}
return true;
}
public static void M()
{
bool observedException = true;
try
{
}
catch (Exception e) when (ObserveException(e))
{
}
Console.WriteLine("Observed exception: " + observedException);
bool ObserveException(Exception e)
{
observedException = true;
return false;
}
}
public static void Main()
{
M();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment