2

I started getting this error recently when debugging a WEBAPI project (C#) in VS 2012 (update 2) on my dev machine. The app is hosted in IIS Express running locally on my dev box.

"Thread was being aborted".

The weird thing is that this error happens only when debugging. It works fine when the debugger is detached. It also seem to happen at random locations in the code file where I have breakoints set. Once the break point hits, I am able to step through upto a certain point and then the error occurs. I have tried to explicity catch the error and here is what I get when I try to expand the exception details. "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack". All the exception properties have the same error message.

NOTE: I have no Response.Redirects as many have pointed out could be the root cause.

Recently I had the following items installed on this box: 1)NodeJS 2)NodeJS Tools for Visual Studio 3)Web Essentials Tools 4)Doubled the RAM on my box from 8 to 16GB (max).

I have undone the above but not sure if any of those could be the root cause. Since unintalling I have also "Repaired" Visual Studio and also deleted my user profile and recreated it to no vain. I am attached to a windows domain. Not sure if this is a Visual Studio anomaly or whether my installation is genuinely screwed up.

Any help/insights appreciated.

Abhijeet Patel
  • 6,562
  • 8
  • 50
  • 93
  • This is a timing issue. Something is taking longer than expected to execute. – emerson.marini Sep 25 '14 at 20:50
  • I experienced this issue when using Task.Run() code. If I remove Task.Run(), it works fine. I believe it is the debugger aborting the task for some reason, considering it has completed, when in actuality it hasn't. – Asif Shiraz Jun 02 '16 at 17:47
  • Yes. I was running into this when debugging async code. I don't have/use an explicit Task.Run but it seems to be a timing / locking issue with the debugger when debugging async code. – Abhijeet Patel Jun 08 '16 at 06:34
  • Ever resolve this? – Mark Nadig Jun 17 '16 at 01:37
  • @digger69: Not really, I believe the debugger was causing a deadlock when debugging an async code segment. I presume others have run into this as well. Basically I disabled the breakpoint for the run and it was all good. This never occured at runtime and in prod run so I never pursued it further. Hope this helps – Abhijeet Patel Jul 17 '16 at 05:09
  • Thank! I found my watch statements were causing the deadlock. Clearing those resolved it for me. – Mark Nadig Jul 17 '16 at 13:04

0 Answers0