Exception caveats

Component: NServiceBus

NServiceBus cannot guarantee the handling of certain types of exceptions.


If an AccessViolationException is thrown, the endpoint is likely to terminate. This is because an AccessViolationException thrown by the common language runtime cannot be caught by a try...catch block.

While this problem can be mitigated by using HandleProcessCorruptedStateExceptionsAttribute, Microsoft explicitly recommends not to do this.

Corrupted process state exceptions are exceptions that indicate that the state of a process has been corrupted.

For more information see Handling Corrupted State Exceptions.


If a StackOverflowException is thrown, the process will terminate because the exception cannot be caught by a try...catch block.


If an OutOfMemoryException is thrown, the process may terminate. This is because, even though this exception type is handled in the same way as all others, if the lack of sufficient memory persists, another instance of OutOfMemoryException may be thrown while the original exception is being handled.

Last modified