GurdeepS
GurdeepS

Reputation: 67263

Why are stackoverflow exceptions sometimes intermittent?

I was debugging an application which I took ownership of at work and was getting frequent StackOverflowExceptions.

Examining the code, I saw a cycle as follows:

  1. Instantiate object
  2. object's constructor calls a method
  3. this method calls the object instantiated at 1).

However, my colleagues used the application but do not seem to get any exceptions. I do when I am debugging the application and stepping through the code quite frequently.

Thanks

Upvotes: 0

Views: 179

Answers (1)

Alex F
Alex F

Reputation: 43331

I can think about two situations when program can behave under debugger by different way:

  1. Any code executed when Debugger.IsAttached returns true.

  2. Tools - Options - Debugger - General. "Enable property evaluation and other implicit function calls" is checked. In this case, when the program runs under debugger, some properties are called to update debugger Watch window. This can change the program behavior and cannot be reproduced without debugger.

Upvotes: 1

Related Questions