A connection pooling error has occurred

  • Thread starter Thread starter - TW
  • Start date Start date
T

- TW

I just upgraded a webservice to VS 2003 / Framework 1.1. Since the
upgrade, when I run the test harness against it, I get the error
messag "A connection pooling error has occurred". It occurs when
calling the .Close() in a wrapper class.

It appears to be closing the connection, when I break on the line the
error is about to occur on, the connection state is "Open". When the
error occurs, I check the connection state again and it's closed.

Code follows:
#region Constructors
public SQLTextComponent()
{
InitializeComponent();
Core.EdenConnectionInitializer.InitializeConnection(this._edenConnection);
this._edenConnection.Open();
}
#endregion
#region Destructors
~SQLTextComponent()
{
if (this._edenConnection.State == ConnectionState.Open )
{
this._edenConnection.Close(); // <-- Error occurs on this
statement
}
}
#endregion
 
Hi,

Oh man, this is so wrong.
Don't ever never do anything in destructor except for releasing the
*unmanaged* objects.
Thus, you would be better of implementing IDisposable interface and close
connection within Dispose method.

HTH,
 
Miha,
Man, you are so right. ;-)
I had seen the disclaimer regarding the Finalize event, but hadn't
realized that the desctuctor = finalize (lack of formal education).
After implementing the IDispose interface, no more errors. Thanks for
the advice!
- Rick
 
Back
Top