Hi folks,
I'd like to know if there is a way to throw an Exception from inside a function, but to not include that function in the exception stack trace. E.g.
void ThrowException()
{
throw Exeption();
}
And then, if I call that function from a function called foo()
I want the exception stack trace to start with at foo()
, not at ThrowException()
. I assume if this was possible it might be through the use of attributes on the method.
I'm interested in the general answer, but in case this isn't possible, what I'm really trying to do is create an extension method AssertEqual()
for IEnumerable that I'll use in NUnit tests. So when I call MyEnumerable.AssertEqual(otherEnumerable)
and it fails, NUnit should report the error inside the test function, not inside the extension method.
Thanks!