473,322 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

VS2005 + Safe handle has been closed

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.Dangerou sRelease()
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
Oct 14 '05 #1
3 12470
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/produc...4-06a4e23bfc6f
"Philippe Trottier" <Philippe Tr******@discussions.microsoft.com> wrote in
message news:5F**********************************@microsof t.com...
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.Dangerou sRelease()
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

Oct 14 '05 #2
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

"Andrew Robinson" wrote:
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/produc...4-06a4e23bfc6f
"Philippe Trottier" <Philippe Tr******@discussions.microsoft.com> wrote in
message news:5F**********************************@microsof t.com...
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.Dangerou sRelease()
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


Oct 14 '05 #3
Philippe,

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

-Andrew
"Philippe Trottier" <Ph**************@discussions.microsoft.com> wrote in
message news:1C**********************************@microsof t.com...
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

"Andrew Robinson" wrote:
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/produc...4-06a4e23bfc6f
"Philippe Trottier" <Philippe Tr******@discussions.microsoft.com> wrote
in
message news:5F**********************************@microsof t.com...
> 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.Dangerou sRelease()
> 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


Oct 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Philippe Trottier | last post by:
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...
0
by: Darrell Wesley | last post by:
I'm getting at the end of the application a "ObjectDisposedException was unhandled" warning with the statement that "safe handle has been closed". What does that mean? The application is building...
0
by: gm | last post by:
Immediately after generating the Access application from the Source Safe project I get: "-2147467259 Could not use ''; file already in use." If Access database closed and then reopened I get:...
4
by: Joe | last post by:
I need to some how add a page to a tabcontrol. The problem is I have a single method to bring up the dialog which contains the tabcontrol and doesn't return until the dialog is closed and I don't...
2
by: semedao | last post by:
Hi , someone know the reason and how to handle it? thanks
3
by: rb | last post by:
Developing web site like I've been doing it so many times before and all of the sudden - literaly - symantec jumps in start complaing about viruses found in temporary dll's created in temp .NET...
0
by: =?Utf-8?B?aGVyYmVydA==?= | last post by:
I read from a serialport using a worker thread. Because the worker thread t does not loop often, I cannot wait to terminate the worker thread using a boolean in the While condition. So I have a...
3
by: shad3jd | last post by:
Hi everyone, first post here AND new to VB.NET .. So please excuse any goofs that follow! I have written a simple console application that extracts data from multiple XML files and inserts the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.