I've this error, which occurs on a webapi I build:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1/ROOT/MyWebAPI
Process ID: 43144
Exception: IBM.Data.DB2.iSeries.iDB2SQLErrorException
Message: SQ20377 Character X' 3F' cannot be mapped to a valid XML character.
StackTrace: at IBM.Data.DB2.iSeries.iDB2Exception.throwDcException(MpDcErrorInfo mpEI, MPConnection conn)
at IBM.Data.DB2.iSeries.iDB2Command.reportDCError(Int32 rc)
at IBM.Data.DB2.iSeries.iDB2Command.fetch()
at IBM.Data.DB2.iSeries.iDB2DataReader.MPDataReader.FetchData(UInt32& rowsReturned, UInt32& blockNumber)
at IBM.Data.DB2.iSeries.iDB2DataReader.MPDataReader.FetchThread()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Every query to DB2 are catched, so any error should be logged and managed. But instead, "sometimes" (not always) the whole application pool go down due to these errors.
I said sometimes because some of those errors on Event Viewers (which are the same) are logged, but don't stop the IIS pool.
Its running .NET v4.0.
What can it be? Can a try/catch be bypassed? Very weird...
EDIT:
most try/catch are generic:
try
{
}
catch (Exception ex)
{
}
some are specifics, such as:
int rowCount = 0;
SqlBuilder.Template template = null;
try
{
template = CreateSQLTemplate(filters, "rowcount");
using (iDB2Connection db2 = new iDB2Connection(Properties.Settings.Default.AS400Connection))
{
var rowCounts = db2.Query<int>(template.RawSql, template.Parameters);
rowCount = rowCounts.Count() > 0 ? rowCounts.First() : 0;
}
}
catch(iDB2SQLErrorException db2Sqlex)
{
//
}
catch (Exception ex)
{
//
}
This can be enough, can't be?