Windows 10 ThreadAbortException on Response.End and Response.Redirect

584 Views Asked by At

After upgrading my development computer to Windows 10 my ASP.NET app has started giving a ThreadAbortException any time Response.End or Response.Redirect is called.

I understand from research that this is expected and that you can call other functions instead that won't raise the error. However I've never had to handle this error before upgrading to Windows 10. Previously I was running Windows 8.1 with .NET 4.52 and Windows 10 is now .NET 4.6 so I'm thinking that has something to do with it. So the question is why has it just now started throwing the exception and is there a way to get it to stop without converting my code.

Thread was being aborted.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Threading.ThreadAbortException: Thread was being aborted.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[ThreadAbortException: Thread was being aborted.]
   System.Runtime.InteropServices.GCHandle.InternalFree(IntPtr handle) +0
   System.Runtime.InteropServices.GCHandle.Free() +77
   System.Web.Util.GCUtil.UnrootObject(IntPtr pointer) +65
   System.Web.ApplicationStepManager.ResumeSteps(Exception error) +687
   System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +247
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +647

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.79.0
1

There are 1 best solutions below

1
On

Microsoft has acknowledged this bug in .NET Framework 4.6: https://connect.microsoft.com/VisualStudio/feedback/details/1605438/disabling-ryujit-breaks-asp-net Some things you can try:

  • Remove the UseLegacyJIT value from the registry
  • Uninstall Windows update 3083186