handling Stack overflow Exception
-
hi guys ! need some help... i m using Devmail.net component for downloading mails but while using it i m having a problem there occurs a Stack overflow Exception while downloading msg.MessageSource (body of message) in some mails ,becuase of it my whole application crashes and i m unable to handle it in try catch block.. can any one help me in telling how to catch this exception i m using c# and the programming language can anyone hlp me as i tried a lot in Devmail.net help and forum but couldnt find the solution its urgent... thanks abhinav Systweak Inc. jaipur India..
-
hi guys ! need some help... i m using Devmail.net component for downloading mails but while using it i m having a problem there occurs a Stack overflow Exception while downloading msg.MessageSource (body of message) in some mails ,becuase of it my whole application crashes and i m unable to handle it in try catch block.. can any one help me in telling how to catch this exception i m using c# and the programming language can anyone hlp me as i tried a lot in Devmail.net help and forum but couldnt find the solution its urgent... thanks abhinav Systweak Inc. jaipur India..
Unfortunatelly as of .net 2 you cannot catch this exception. Here is the info from .net docs: In prior versions of the .NET Framework, your application could catch a StackOverflowException object (for example, to recover from unbounded recursion). However, that practice is currently discouraged because significant additional code is required to reliably catch a stack overflow exception and continue program execution. Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the corresponding process is terminated by default. Consequently, users are advised to write their code to detect and prevent a stack overflow. For example, if your application depends on recursion use a counter or a state condition to terminate the recursive loop.