views:

126

answers:

3

Hi

I m having a problem with satckloverflow exception it comes from a method and does not get caught i m using c#.net 3.5 please help...

+1  A: 

Step through the code and figure out why the method is being called over and over. It's probably a logic error that is keeping the recursion from stopping.

David
actually i m using a 3rd party dll and the exception comes from that dll, dll works perfectly fine in most of the cases but found an instances where app crash due to this even i put the method call in try catch block still exception can't be caught.
Ahsan Iqbal
You can't catch a stack overflow.
Ed Swangren
ya i cant catch it and after some googling i found that this exception can't be caught..
Ahsan Iqbal
@Ahsan, you should contact the 3rd party vendor, as it could be a bug in their dll. I'd also check if you have any event handlers that may be calling the 3rd party code that may be calling the event handler and so on.
Dan Bryant
A: 

As I am unfortunately not clairvoyant, it is impossible to answer your question unless you post some code. However, a very common cause of this for beginners is using the property instead of the backing field in a getter or setter, i.e.,

string _someProperty;
string SomeProperty
{
    get { return SomeProperty; } //oops
    set { SomeProperty = value; } //oops
}
Ed Swangren
A: 

StackOverflow is a pain to debug. OutOfMemory is another. You may want to get a crash dump using the Debug Diagnostic Tool and use WinDbg to see the stack that caused it.

Conrad Frix