I have a function that looks like this:
try { _dbManager.InsertSearch(some data); } catch (Exception ex) {
_dbManager
uses LINQ to insert data into an SQL database. Yesterday, the machine hosting the database ended up with a lack of hard disk space, and my program crashed. I have a crash dump that shows that there was a SqlClient.SqlException
with an exception message reading something like "Database transaction log is full ...".
My question is: Why did the exception not fall into the catch block above? Strange, when I tried to reproduce the problem, I could get the same exception, but this was caught by the catch block. What could be the problem?
Secondly, a related question: Imagine if we use a third-party library and we do not want an exception to occur. We can use a try-catch block, but this only works when a thread is called. What if a third party starts a new thread and an exception occurs there? Is there any way to handle this? I know that I can register our UnhandledExceptionHandler
, but it looks like what I wanted.
source share