16

I've been messing with VS 2010 debugging settings, trying to get stepping into the .NET Framework working. Well, I can't get it to work. I've also tried the Reflector VS plugin and that was working at one point.

Then I randomly started getting this error:

enter image description here

This only happens when I have a breakpoint on a line that calls IEnumerable<T>.ToList(). If I try to step-over or step-into on that line where my breakpoint is set, I get this error dialog and my debugging session ends.

If I move the breakpoint to the line below, the debugger makes it past the ToList() call!

I've tried the following to no avail:

  • Removing the Reflector plugin.
  • Undoing my changes in the Tools > Options > Debugging window (unchecked the option to step into the .NET Framework; unchecked the source server option; checked the just my code option).
  • Unchecked Microsoft Source Server in the Tools > Options > Debugging > Symbols window.
  • Cleared the symbol cache.

What is going on?

2
  • Could you post your call stack when the breakpoint hits? Commented Apr 27, 2011 at 19:10
  • I could, but it wouldn't help since I can't step in at all. I know that the line in question throws a StackOverflowException if I remove the breakpoint.
    – Josh M.
    Commented Apr 27, 2011 at 20:13

9 Answers 9

7

Because this was the first place I came to when I searched for an answer, I'll add what I found out.

In my case, I had the debugger set up in the solution to start multiple projects. For some reason this setting was changed by Visual Studio so that no project was starting. Correcting the setting in the solution immediately solved the problem.

The problem was not difficult to solve, but the error message was more than a bit irritating.

4

I've just found this answer useful. All I did was change my start-up project to another, and back to normal.

My project probably lost this setting somewhere, and resetting it made it available again.

2

It was a ToString() override that make the debugger crash ! (After the evaluation the debugger will show you the result with the ToString() method). And if you get an exception in the ToString(), you will never catch an exception because you cannot code them on the debugger behaviour.

I've got this answer from msdn

1

I suffered from same problem....

I found one solution which heard uncommon....

The debugger cannot continue running the process.Process was terminated While debugging your code step by step , you will find the line , from where error redirecting. If you are using " ToString() " anywhere in that file ,please remove that . Instead of the ,you can use Value / Text . It works fine. ............

If you were not used ToString() any where in program , then reload project copy by removing completely.

1

I had the same problem. I traced it down to a class(step-by-step debugging) and finally to a property(commenting all the code, then step-by-step uncommenting).

this property returned a typed dataSet from a table.Dataset

private typedDataSet myDataSet
{
   return this.DataSet as typedDataSet;
}

this was in a DataTable partial class. After I removed this property everything went OK.

1

I ran into this issue with a code bug from copy/paste. Instead of get/setting the private member variable, I did a get/set on itself. When I referenced the property in other code the debugger terminated (2010):

public bool ProdToDeve
{
   get { return ProdToDeve; } // <= missing underbar
   set { ProdToDeve = value; }
}
private bool _ProdToDeve = false;
0

This message will also show up when you're trying to debug a Xamarin solution but you have a class library selected as the startup project instead of your application porject.

0

It occurred to me when I was doing the following:

throw new Exception(timeout.TotalSeconds + " second(s)");

That's because timeout.TotalSeconds.ToString() which indeed is an override method for an object of type double, was throwing a Parameter not valid exception.

Finally, for safety I ended up doing the following:

throw new Exception(System.Convert.ToString(timeout.TotalSeconds));

0

Well, typically, this is also the kind of error message you can get in a multi-threads context. In brief, it involves concurrency : make sure that your resource accesses are always secured.

In my case, I got this error message when I forgot to secure resource accesses at some places within my code. To solve this issue, I just had to decorate the critical sections with a lock instruction (on the concerned resource). I hope this will help those who are in this context.

Not the answer you're looking for? Browse other questions tagged or ask your own question.