View Ticket
Not logged in
Ticket Hash: 98c70ac5a764cb3e621fc1366cd265f38a17a89f
Title: SQLiteFactory raises CallbackOnCollectedDelegate
Status: Closed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Logging Resolution: Fixed
Last Modified: 2011-10-20 07:23:26
Version Found In:
Every time I access an instance of System.Data.SQLite.SQLiteFactory, I get this exception when in debug-mode. Can I safely ignore it? Or what can I do to prevent this error?

mistachkin added on 2011-10-17 14:09:33 UTC:
I'm not able to reproduce this issue. Could you provide some more details about the kind of behavior you are seeing and what code triggers the issue?

anonymous added on 2011-10-17 17:34:16 UTC:
I only have this problem with the DLL here on this site, I never encountered using the dll from Phx Software (using the same code).

I only see the error when I set the IDE to break on ALL thrown exceptions.

The code looks like this:

Private Class Sql

Private Factory As New System.Data.SQLite.SQLiteFactory()
Public Function Connect() As Boolean
Dim Conn as DbConnection = Fact.CreateConnection()
End Function

End Class


It seems to be related to threads. The first thread has no problems creating a new instance of the class above, but the second thread will complain with:

A callback was made on a garbage collected delegate of type 'System.Data.SQLite!System.Data.SQLite.SQLiteLogCallback::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.

mistachkin added on 2011-10-18 03:08:39 UTC:
Possibly fixed by checked-in [3303a4f55b]. I still need to come up with a test case for this. Meanwhile, would you please test this fix in your environment and let me know if the issue is still present?

anonymous added on 2011-10-19 16:58:20 UTC:
I'm not familar with building the library myself, so I'd have to wait for

anonymous added on 2011-10-19 17:15:50 UTC:
Okay, I made some progress. Turns out I was using version of the library. I just upgraded to 1.0.76, and I have not encountered the problem since then. So I guess this bug is already fixed in the commits between .74 and .76.