I'm occasionally getting this exception, and don't seem to be able to find anything here on SO or google that can shed some insight as to how to debug this.
System.ArgumentNullException: Value cannot be null.
Parameter name: transaction
at System.Transactions.TransactionInterop.
GetDtcTransaction(Transaction transaction)
at Oracle.DataAccess.Client.OracleConnection.Open()
at RetrieveMessage() ...
My code is fairly straightforward. RetrieveMessage() is a call to pop a message off a queue, but that isn't relevant since this fails just trying to open the connection.
using (var scope = new TransactionScope(TransactionScopeOption.Required,
TimeSpan.FromMinutes(10)))
{
message = RetrieveMessage();
// ...
scope.Complete();
}
//...
public Message RetrieveMessage()
{
using (var cnn = new OracleConnection(ConnString))
{
cnn.Open(); //sometimes fails???
//... execute a stored procedure that calls dbms_aq.dequeue()
}
//... return dequeued message or null if queue is empty
}
My connection string looks like the following: Data Source=abc;User ID=test1;Password=test1;Pooling=true;Validate Connection=True
ODP.NET: version 2.112.1.0, .NET Framework 3.5 SP0
Why wouldn't there be a transaction available when I've explicitly created one already?
I believe this happens when the TCP port that the client is trying to use is closed by an agent other than the database server or the client. We've been able to simulate this by using TCPView to close all connections on port 1521 between client and server and then trying to open a connection within the same process. In the real world, we believe that an internal firewall is closing the connections due to inactivity. Short of preventing the connections from being closed, though, I have not yet found an actual solution to this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With