I have a Console application which look as below,
static void Main(string[] args)
{
try
{
System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
// My Code
}
catch(Exception ex)
{
}
}
static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e)
{
// The code.
}
In the above code neither the catch is firing nor UnhandledExceptionTrapper. It suddenly says application stopped working. Event viewer has no important info about crash. Event viewer says some file exist but when check nothing there. I am using .NET 4.6.1.
The code just pulls data from oracle (using dapper) and using TransactionScope.
Edit: We have found the culprit line. It was doing a Update in Oracle wrapped inside TransactionScope. The problem is that unable to catch these exception and its coming sometimes and failing most of the time. These are sample code that uses Dapper to update Oracle.
using (var scope = new TransactionScope())
{
UpdateOracleUsingDapperMethod();
scope.Complete();
}
We found the issue is related to OleDbConnection
. So, we moved to OracleConnection
and no crash. This means using Oracle in Dapper with TransactionScope
and OleDbConnection
have some serious issues.