It looks like you need to go back through your code and look at the exception handling. Either there are sections of code that are not inside the try/catch , or you have several try/catch blocks that do not handle all possible exceptions.
You need to make sure that when you end these sections of code with try/catch blocks, you are not just eating errors, but writing them down. You do not want your application to have unexpected errors without any action, because these unforeseen errors can leave your application in a vulnerable state. Sometimes it's better to let your application crash than to hide these errors.
Here is a good article on using try/catch :
http://msdn.microsoft.com/en-us/library/ms173160.aspx
When you implement try/catch , make sure that you also consider entering finally to clear any connection information or other code that needs to be closed. It will look like this:
try {
Note that the catch block catches a general Exception , so all errors that were not detected above (in more specific catch blocks) should be detected here.
source share