I have an application that uses a DLL to make API calls. Is there a way to prevent my application from crashing when the DLL crashes? I tried putting a try/catch around each call, but that doesn’t work.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the DLL is a third-party library you cannot modify you can load and execute the code in a separate AppDomain.
If it is your own code it would be best to fix the bugs first. A
NullReferenceExceptionalmost always indicates a bug in your code that should be fixed.As you are not able to catch the exceptions with a try/catch blog I would assume that the exception occurs on another thread. Either wrap the method(s) on the other thread within a try/catch block or use the AppDomain.UnhandledException event to catch it.