I am using System.Data.SQLite in my project. When the System.Data.SQLite DLL is not in the output folder, I cannot catch a FileNotFoundException (another exception is caught). Here is the exapmle code:
private void button1_Click(object sender, RoutedEventArgs e) { try { SQLiteConnection conn = new SQLiteConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
MessageBox is not displayed. If I extract this code into a separate function and end this function call in try catch, and the catch exception will fail, the MessageBox will show:
private void DeclareConnection() { SQLiteConnection conn = new SQLiteConnection(); } private void button1_Click(object sender, RoutedEventArgs e) { try { DeclareConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
What is the problem?
source share