With an MVC 5 project we're working on I keep on getting a ThreadAbortException every time the application starts up (while the debugger is attached). I assumed it was related to the application so I created an empty project with a single controller and an empty view.
HomeController.cs:
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
}
The exception still pops up as soon as the webapp starts up and the debugger is attached. As you can see, there is no Response.Redirect that might cause it. And there is no additional code in the Global.asax which might spin up an extra thread.
Global.asax.cs
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
}
The exception occurs when I do a rebuild, start the application with the debugger attached and exactly as soon as the app has started up. There is no stacktrace and it doesn't terminate the app, just:
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll and wasn't handled before a managed/native boundary
I'm using Visual Studio 2013 (Update 2) and the app is running in IIS Express. The project is targeted at .NET 4.5 and has Razor views.
Is there anything else I can try?
Turns out all I had to do was disable this setting:
For those interested, it's under Tools -> Options -> Debugging -> General -> top of the page.
Of course that doesn't prevent the exception from happening though. So I'd still like to know why a ThreadAbortException is being tossed accross a managed boundary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With