I have a segment of code:
try
{
//sniping out a bunch of irrelevant code here
result = cmd.ExecuteScalar();
onExecution?.Invoke(result);
return true;
}
catch (SQLiteException e)
{
if (e.ResultCode == SQLiteErrorCode.Corrupt)
{
CorruptionDetected?.Invoke(null, EventArgs.Empty);
}
//snip - else if {etc}
throw;
}
The problem: I have VS to set to break on all exceptions always all the time no matter what without exception. VS does this correctly and without problem on every other exception everywhere in the program EXCEPT for this one.
I know WHY the error happening. That is of absolutely no interest to me whatsoever and is unrelated.
What I want to know is why that problem seems to either not actually generate the exception or else isn't catching it. I know with 100% certainty that errors are happening. You can see them in the Events tab in the Diagnostic Tools window. They pile up there but at no point do I ever get a catchable exception, just useless garbage in the Events tab.
How do I deal with this? If the error (SQLite error (5): database is locked) is a problem, then why am I not getting an exception? If it's not a problem and it's getting eventually processed, why is it polluting my Events list?
The way it currently stands is just utterly unacceptable as it makes absolutely no sense. Either it's a problem in which case I should get an exception or it's not a problem in which case I don't want to be inundated with useless debug events.