Using the .NET CLR, is there a way to prevent a certain method to show up in the stack trace? Especially I just want to remove the last call from the stack trace before throwing an exception.
I’m just curious, unsafe calls and reflection hacks are valid solutions.
If it’s your
Exceptionimplementation, you can overrideStackTraceto return whatever you like. And the this constructor of theStackFrameclass makes it easy to create a stack trace whilst skipping any number of methods.