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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top