We are randomly getting this error message on our development and staging machines:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.; at System.Data.Common.UnsafeNativeMethods.OraMTSJoinTxn(OciEnlistContext pCtxt, IDtcTransaction pTrans)
at System.Data.OracleClient.TracedNativeMethods.OraMTSJoinTxn(OciEnlistContext pCtxt, IDtcTransaction pTrans)
at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction, Boolean manualEnlistment)
at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)
at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OracleClient.OracleConnection.Open()
We are using VS2005, C#, Oracle 10g Client, and the TransactionScope. When we get this error, it's usually either on the opening of the connection OR on the execution of the proc/package. We had to install the client, then install, as a separate package the oracle support for MTS which supports transactions.
Here is a snippet of code that causes this error:
using (TransactionScope scope = new TransactionScope()){
using (IDbConnection connection = this.GetConnection()){
connection.Open();
...DO SOME STUFF
try{
command.ExecuteNonQuery();
foreach (IDataParameter parameter in command.Parameters){
if( parameter.Direction.Equals( ParameterDirection.InputOutput ) || parameter.Direction.Equals( ParameterDirection.Output ) )returnParameters.Add(parameter);
}
}
catch (Exception ex){
// ERROR HANDLING HERE}
}
}
scope.Complete();
}
Like I said, it happens randomly, but when it does occur, it's on one of those two methods Open or Execute. Does anyone have any idea why this breaks down

Attempted to read or write protected memory error in TransactionScope with OracleClient(10g)
mic90264
We have the same problem.
Damjan
Hema Bairavan
Ludwig
I routinely experience this error when developing, but not when the app is released. The solution for me is simple:
Ensure the Distributed Transaction Coordinator service is started (set Startup = Automatic)
Perform a Clean Solution from the build menu, then re-run your app
delasare
Jamie Sellars
So, if you seeing this problem make sure all of your parameter names are less than 30 characters long as a first step. :-)
marius bogdan
Looks like somebody is corrupting your application memory.
You can try using the Application Verifier to see who is doing that: http://www.microsoft.com/technet/prodtechnol/windows/appcompatibility/appverifier.mspx
Hope this helps.
Connie Daniel