StackOverflowException

  • Thread starter Thread starter Clive Foley
  • Start date Start date
C

Clive Foley

Hey all,

any ideas on what causes the above exception and any
ideas on how to overcome it?

Thanks,
Clive Foley
 
Clive Foley said:
any ideas on what causes the above exception and any
ideas on how to overcome it?

Usually it's because you're calling a method recursively accidentally.
Have a look at the stack trace and see what's being called.
 
You can also get this from typos in properties, for example

private int myValue = 0;

public int MyValue {
get {return this.MyValue;}
set {
this.myValue = value;
}
}

the above code compiles fine but will generate a stack overflow if you try
and read the value of MyValue as it is recursive.
 
Back
Top