SQL Server Compact Edition (SQL CE) hangs in SqlCeConnection.Close(), caused by GC.WaitForPendingFinalizers() - by Rene Schulte

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 411912 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 2/6/2009 3:33:29 AM
Access Restriction Public


Calling SqlCeConnection.Close() (or implicit through SqlCeConnection.Dispose()) could result in a deadlock of the calling Thread. This behavior is caused by GC.WaitForPendingFinalizers() in SqlCeConnection.Close(). GC.WaitForPendingFinalizers() waits for the GC-Finalizer-Thread to finalize all pending instances. There are a lot of circumstances, where it is not guaranteed that all finalizers will be terminating gracefully.

We encountered this problem in our application. As a result our whole application hangs!

See also http://social.msdn.microsoft.com/forums/en-US/sqlce/thread/40e82853-b8b7-4512-bdc5-0268f4fe6f15
Sign in to post a comment.
Posted by .bland on 2/19/2015 at 11:33 AM
This fix was released in SqlCE3.5SP2 according to 'SQL CE Team':

A hotfix was also released in case anyone needs:
Posted by .bland on 2/19/2015 at 11:31 AM
In case anyone ever looks at this again and wonders about the previous comments questioning what version this was fixed in:

It was released in SqlCE 3.5 SP2:

Hotfix for previous version:
Posted by Abby Fichtner on 11/26/2009 at 9:37 AM
When you say the fix is in the "2010 beta 2" do you mean SQL Server Compact 3.5 Service Pack 2 Beta 2 for Windows Desktop, which is available here?


If not, could you provide a URL from where we can get the version you're referring to?
Posted by ChrisTypeR on 9/17/2009 at 1:48 AM
I have managed to work around this issue by using SQLite instead.
Posted by ChrisTypeR on 9/14/2009 at 1:07 AM
Any updates on this ? Is a public fix available ?
Posted by Microsoft on 8/5/2009 at 9:43 PM
Hello Rene Schulte,

We have analyzed the issue and the fix will be available in Dev10 Beta2 release of SQL Server Compact.

Posted by Nanda.Dodd on 7/30/2009 at 12:00 PM
Any updates on a fix for this bug. This happens in our application while using .NET table adpaters .Fill methods. Doesn't look like I can use your workaround, since the code is generated by the designer. A timeline would be great!!!
Posted by Amit Jhawar on 4/14/2009 at 7:13 PM
is there a tentative timeline when this bug will be fixed? any plans to release a hotfix for this bug?
Posted by Microsoft on 3/9/2009 at 6:33 AM
Thanks for the feedback. We have analyzed the issue and the fix will be available in the next release of SQL Server Compact.

Thanks and regards,
Posted by Microsoft on 3/2/2009 at 4:13 AM
Hello Rene Schulte,

Thanks for reporting the issue with SQL Server Compact. We are analyzing the issue and will revert back to you with the finding of our analysis. If you would like an update on the status of the issue please post back to this thread.