Doesn't rise native .net exception #1780
-
If I use this code only using (new AssertionScope())
{
AssertionScope.Current.FailWith("AssertionException");
throw new Exception("Exception");
} How I can catch .net exception ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I'm not sure what you're trying to do. |
Beta Was this translation helpful? Give feedback.
-
Ah, you mean that in the first example, you were not expecting the |
Beta Was this translation helpful? Give feedback.
-
Actually, it works as expected. The |
Beta Was this translation helpful? Give feedback.
Actually, it works as expected. The
AssertionException
isn't thrown until theusing
block ends. The problem is that theDispose
ofAssertionScope
throws its own exception and that hides the other exception that was thrown in the same scope.