Skip to content

Compatibility: Thread Abort semantics

Michael Ketting edited this page Feb 1, 2023 · 1 revision

.NET Core no longer supports the automatic rethrow of ThreadAbortException. Web Forms uses ThreadAbortExceptions for control flow. Application code that catches these exceptions and fails to rethrow them will not work in these situations. A typical issue would be a catch-all block.

Any code path that may rely on HttpServerUtility.Transfer or ThreadAbortException must be reviewed with respect to the use of catch-all blocks. Catch-all blocks must then be updated to explicitly rethrow ThreadAbortException:

try { ... }
catch (Exception ex) {
   ...
   if (ex is ThreadAbortException)
      throw;
}

This applies to applications as well as to third-party components.