473,406 Members | 2,343 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,406 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 12475
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.