Here's a good one... I've got this code that basically fills a DataTable with some values retrieved from a SqlDataAdapter. The whole thing is surrounded by try/catch blocks, log4net error logging, i.e. the works. The application is terminating on the adapter.Fill(table) method. No exceptions are thrown and I've verified the connection is open and the SQL is good before the call. Has anyone experienced this yet?
System.Data.SqlClient.SqlConnection con = null; System.Data.SqlClient.SqlDataAdapter adapter = null; System.Data.DataTable table = new System.Data.DataTable("RecoveryTestFeed");
try { con = new System.Data.SqlClient.SqlConnection(dsn); con.Open();
string sql = string.Format("{0} WHERE {1}", GetQueryStringByFieldName(dsn, strUserID), whereClause.Replace("WHERE", ""));
adapter = new System.Data.SqlClient.SqlDataAdapter(sql, con); adapter.SelectCommand.CommandTimeout = dbTimeOut;
debug("[SQL] {0}", sql); // looks good upon inspection
// Application dies at this statement adapter.Fill(table); ... } catch(System.Exception sx) { // This area is never entered log.Error("", sx); } finally { if(con != null) con.Close(); //The above statement isn't called either }
Yes and all Managed. That method is apart of a library that I built, it's used for several objects. I've even tried rewriting that section to use a data reader, same result, as soon as I called the cmd.ExecuteReader() method the app craps out. I'm beginnig to wonder if I something may be corrupt somewhere. I'm going to reboot and see what happens.
Found out that it was a threading issue. The main thread was dying before the subthreads were completeing their work. Basically had to add another thread that just slept to keep the whole thing alive. This started happening after applying XP SP3. Not sure if that could be the issue or not, but it's fixed.