Wednesday, April 11, 2012

Resolution for eConnect 2010 Error: The Transaction Has Aborted

Back in September 2011 I wrote about an error I was receiving with a few eConnect 2010 integrations.  In apparent random fashion, the integration would throw the following eConnect exception:

     The transaction has aborted

I researched every aspect of the error that I could think of, and tried every workaround I could imagine, but the error would still occur intermittently with two integrations.  Strangely, the error did not occur with 10 other eConnect integrations running on the same server.

I created a GP support case and worked with Aaron at MS Support over several months trying to figure out the cause and possible ways of troubleshooting the problem.  A few weeks ago, Aaron contacted me to let me know that another customer was getting the same eConnect error, and that they seem to have found the cause.

That customer was calling the eConnect GetNextSopNumber class, and in the process, was also using the Dispose method when using that class.  GP support was able to reproduce the issue with those two elements, apparently triggered by the Dispose method, and they have documented it as a bug.

My two integrations that were getting the error don't use GetNextSopNumber, so I was initially concerned that the other customer's solution wouldn't apply to me.  And as a general rule, I never use Dispose, so I was further concerned that I might be dealing with a different cause for the error.

I found my source code and realized that the two integrations getting the error were older projects that were written in VB, which I stopped using in 2010 after I switched to C#.  I then searched the project for "Dispose", and to my surprise, I was calling the method after submitting data to eConnect.

            returnValue = eConCall.CreateTransactionEntity(gpConnString, transactionXML)

After each call to CreateTransactionEntity and CreateEntity, the Dispose method was being called.  I obviously copied that line from somewhere / someone, since I can't imagine that I would have added the call on my own and have never used it in any of my C# integrations since.

So I went ahead and commented out the Dispose method and deployed the new integrations on the client's server.

It has been about two weeks since I made that change and we haven't had a transaction aborted error since.  We're still monitoring the logs to confirm that the issue is fully resolved, but it's looking good so far.

So, it seems that calling Dispose with any eConnect 2010 class can trigger the error, and simply removing the Dispose call should resolve the issue.

Steve Endow is a Dynamics GP Certified Trainer and Dynamics GP Certified IT Professional in Los Angeles.  He is also the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

No comments: