This answer ignores your BSoD and your Ping class, and focuses on the very interesting question of:
How to prevent the Visual Studio Debugger from stopping inside a specific method
(Note: this is "stopping", with an "o", not "stepping".)
So:
What seems to work nowadays is the [DebuggerHidden] attribute.
So, for example, consider the following method:
///An assertion method that does the only thing that an assertion method is supposed to
///do, which is to throw an "Assertion Failed" exception.
///(Necessary because System.Diagnostics.Debug.Assert does a whole bunch of useless,
///annoying, counter-productive stuff instead of just throwing an exception.)
[DebuggerHidden] //this makes the debugger stop in the calling method instead of here.
[Conditional("DEBUG")]
public static void Assert(bool expression)
{
if (expression)
return;
throw new AssertionFailureException();
}
If you then have the following:
Assert(false);
The debugger will stop on the Assert()
invocation, not on the throw
statement.