原文地址:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2001893&SiteID=1 I replace
I replace the reference assembly System.Data.SqlServerCe with version 3.5 beta2 in
Microsoft.Practices.EnterpriseLibrary.Data.SqlCe. When I used the Data.SqlCe block in application, an exception ("Cannot access a disposed object named SqlCeConnection") threw. This didn't occur in SSCE 3.5 beta1 and early versions.
Finally I found the difference between beta1 and beta2.
In the SqlCeConnection class, there is a RemoveWeakReference method. this is code snippet of beta1:
and this is for beta2:
So, if we dispose a connection before a command, such as:
SqlCeConnection cn;
SqlCeCommand cmd;
...
cn.Dispose();
cmd.Dispose(); // Error, an exception will be threw.
Is it a bug of Beta2?
|
=================================================
This is a issue in Beta2. Most probably we will fix in SSCE 3.5 RTM. The Bug Id: 13211 tracks this issue.