We are using Oracle.DataAccess.dll (ODP.NET) version 4.121.2.0 with System.Transactions (TransactionScope class). Somehow when System.Transacations invoke the callback method inside ODP.NET the process crashed with heap corrupted exception.
I asked the same question on .NET CoreFx repo https://github.com/dotnet/corefx/issues/39892
I have a long-running .NET console application (4.6.1). Suddenly since fews days I am getting this error in Visual Studio,
`Unhandled exception at 0x77256214 (ntdll.dll) in My.exe: 0xC0000374: A heap has been corrupted (parameters: 0x77272378).`
Pressing F5 again, it shows me another stuck and then stuck with the same error,
`Exception thrown at 0x771B234D (ntdll.dll) in My.exe: 0xC0000005: Access violation reading location 0x656C6573.`
I have global try catch which is not triggering in the console application. I have added,
`<legacyCorruptedStateExceptionsPolicy enabled="true" /> ` and `[HandleProcessCorruptedStateExceptionsAttribute]` but still application crashes without hitting the breakpoint. Then I tried WinDBG (`.loadby sos clr` then `!analyze -v` then `!CLRStack -a` then `!dumpstackobjects`),
```
OS Thread Id: 0x3da4 (0)
Child SP IP Call Site
007cea38 771ac33c [GCFrame: 007cea38]
007cea54 771ac33c [HelperMethodFrame_1OBJ: 007cea54] System.Threading.Monitor.ReliableEnter(System.Object, Boolean ByRef)
007cead0 60f98710 System.Collections.Hashtable+SyncHashtable.Remove(System.Object) [f:\dd\ndp\clr\src\BCL\system\collections\hashtable.cs @ 1518]
007ceafc 0db7405f Oracle.DataAccess.Client.OracleResourcePool.RemoveResourceHolder(Oracle.DataAccess.Client.OracleResourceHolder)
007ceb28 0db73ffd Oracle.DataAccess.Client.OracleResourceHolder.Dispose()
007ceb34 0db7386f Oracle.DataAccess.Client.OracleResourceHolder.TransactionCompleted(System.Object, System.Transactions.TransactionEventArgs)
007ceb38 0086e053 [InlinedCallFrame: 007ceb38]
007cebb0 0086e053 [MulticastFrame: 007cebb0] System.Transactions.TransactionCompletedEventHandler.Invoke(System.Object, System.Transactions.TransactionEventArgs)
007cebdc 556cc0fb System.Transactions.InternalTransaction.FireCompletion()
007cebf0 556ea3f2 System.Transactions.TransactionStatePromotedAborted.EnterState(System.Transactions.InternalTransaction)
007cec08 556ed9c0 System.Transactions.TransactionStateDelegatedAborting.ChangeStatePromotedAborted(System.Transactions.InternalTransaction)
007cec14 556ee8ba System.Transactions.DurableEnlistmentDelegated.Aborted(System.Transactions.InternalEnlistment, System.Exception)
007cec24 556e34d6 System.Transactions.SinglePhaseEnlistment.Aborted()
007cec6c 0e36d662 Oracle.DataAccess.Client.PromotableTxnMgr.Rollback(System.Transactions.SinglePhaseEnlistment)
007cec90 556ed922 System.Transactions.TransactionStateDelegatedAborting.EnterState(System.Transactions.InternalTransaction)
007cecd4 556eb8f5 System.Transactions.TransactionStateDelegated.Rollback(System.Transactions.InternalTransaction, System.Exception)
007cece4 556c9c0a System.Transactions.Transaction.Rollback()
007ced18 556f0f43 System.Transactions.TransactionScope.InternalDispose()
007ced50 556f0da7 System.Transactions.TransactionScope.Dispose()
007cee04 0d49f9ae MyApp.Program.method()
```
Clearly, it's related to TransactionScope and Oracle but dunno why its crashing. For now I am just looking for a work around