1

Its found that sometimes some web exceptions and sql Exceptions are not handled by Exception class. I know that should not happen. But on production I found that issue, unable to reproduce on my local computer.

try{

//some code
}
catch (Exception e){
//Sent mail and logged in db for exception
}

That doesn't work then I added

try{

//some code
}
catch (SqlException e){
//Sent mail and logged in db for exception
}
catch (Exception e){
//Sent mail and logged in db for exception
}

then it works fine. Is it possible in any case?

Rohit
  • 300
  • 2
  • 14

1 Answers1

1

You can subscribe as follows to see where those exceptions are really coming from, because I don't believe they can bypass catch (Exception)

AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
Application.ThreadException += OnThreadException;