UnHendleException?

Sometimes i receive UnHendleException and cause the application to crash, but doesn't crash at the point the exception happened. to find that point  i sat up Exceptions to*space
space*into debugger in Exception dialog ( via main menu --> Debug/Exceptions/Break into debugger ).  then when i run the application, receive a lot of exceptions like following and must  
click on continue to be able to run the application. but the application continues with no crash

A first chance exception of type 'System.IndexOutOfRangeException' occurred in system.windows.forms.dll
Additional information: Index was outside the bounds of the array.

this exception accrue on some methods like merge which doesn't make sense.

The question is: Should i ignore this kind of exceptions, or they may cause the app to crash later on. Is ignoring them make the application unstable  What's the best practice to capture and resolve these exceptions

Thanks for any idea.
Ali



Answer this question

UnHendleException?

  • MrRon

    When I troubleshoot this kind of problem, I setup breaks and walk through my code. That way I found out <u>exactly</u> what's causing the original exception and fix it or catch and handle it. I believe this the simplest method and could possibly serve you best. Hope that helps!
  • William Ramirez

    In addition to Mark's comments, I <b>never</b> ignore exceptions.  I always track down what is causing them and either prevent them from happening again, or handle them gracefully.
  • Robert C. Barth

    I would add a handler to your code for AppDomain.UnhandledException.  That should catch everything that you aren't currently catching.
  • Noulouk

    That's what i am doing tool. but even catch block could not capture some of those UnhandleException. These are the ones that i need to know how i could deal with. 
  • prasannakumar63529

    also take alook at the System.Windows.Forms.Application.ThreadException , cause sometime this is a better option than AppDomain.UnhandledException , i.e. it lets you handle the exception during runtime without causing your app to quit
  • UnHendleException?