VS2005 + Safe handle has been closed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have a C# program developped with VS2003 and Enterprise Library June
2005. I converted it to VS2005B2, recompiled Enterprise Library to VS2005 and
now I'm stuck with a bug when my program closes.

The error messsage says :

ObjectDisposedException was unhandled
Safe handle has been closed

Source : "mscorlib"
Stack trace :
at System.Runtime.InteropServices.SafeHandle.DangerousRelease()
at System.Threading.RegisteredWaitHandleSafe.Finalize()

I've isolated the line that causes the problem. It is located in a method
that retrieves data from the database. Here is the code :

Database db = DatabaseFactory.CreateDatabase("Database Instance");
DBCommandWrapper dbCmd = db.GetSqlStringCommandWrapper(sqlCommand);
DataSet ds = db.ExecuteDataSet(dbCmd);
return ds;

the line I isolated is :
DBCommandWrapper dbCmd = db.GetSqlStringCommandWrapper(sqlCommand);

If this line is executed, the program will crash when I close it. Remark
that the query is executed on the database, and it returns correct values...
The problem is when the program exits...

Did someone ever encountered this problem..???

thanx in advance!

Philippe Trottier
 
Philippe,

Not sure what DB connector you are using, but I had a similar issue with the
native iSeries ADO.NET connector. In this case, MS confirmed that the bug
was on IBM's side and they have since provided us with a hot fix. We have
not tested the fix other than on the surface, it appears to fix the issue. I
am not working on the IBM side so I was invovled with this only briefly.

-Andrew Robinson
haggen.com

The MS post is here:

http://lab.msdn.microsoft.com/produ...edbackId=b7bfbc8c-c6ad-414e-a524-06a4e23bfc6f
 
Thank you Andrew for your answer.

Like you expected, we are using iSeries .net Provider. So I will try to do
what they say on the link you provided, and I hope it will work! :) If it
don't work, is there a way to get the hotfix, or we have to call IBM?

Thanx you again!

Philippe Trottier
 
Philippe,

I don't think there is anything that you can do with the IBM providor to fix
it. Time to call IBM.

-Andrew
 
Back
Top