System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 2556655d1b6ecc05912cc9447073d449a33e03e9
Title: SQLiteFunction.RegisterFunction ArgumentException
Status: Closed Type: Code_Defect
Severity: Important Priority: Medium
Subsystem: None Resolution: Fixed
Last Modified: 2015-10-15 19:39:17
Version Found In: 1.0.98.0
User Comments:
anonymous added on 2015-10-15 15:45:42:
When upgrading to version 1.0.98.0 from version 1.0.96.0, previously working code using SQLiteFunction.RegisterFunction on the desktop Framework (x64 4.0) started to throw ArgumentException when manually registering SQLiteFunction types.

It seems there has been a change of behavior which I have not found documented in the release notes (feel free to point it out though). From what I understand, I can no longer manually add types with SQLiteFunction.RegisterFunction because the SQLite framework would already have loaded them, but I cannot find a way to check if a type has already been registered before adding it. 

This proves to be an issue for me since I have some dynamic assembly loading and share some code base between the regular .NET Framework and the Compact Framework. I can use custom defines to avoid the problem, but I'd rather understand why it's not working anymore.

Could you document the change which occurred in this function, and maybe provide a new helper function like SQLiteFunction.IsRegistered(Type type)?

mistachkin added on 2015-10-15 17:20:00:
The exception is caused by the changes from check-in [187e8cb03dd8b88f], which
occurred between 1.0.97.0 and 1.0.98.0.

mistachkin added on 2015-10-15 17:24:01:
Previously, if you added the same type again, the most recent definition would
"win".  This was due to how the registered functions were tracked internally.

The correct fix here is probably to restore the previous behavior as much as
possible.  The semantic change here was not intentional.

mistachkin added on 2015-10-15 19:19:43:
I've reproduced the issue locally.  Working on fix.

mistachkin added on 2015-10-15 19:39:17:
Fixed on trunk via check-in [cb9c3d67aa3a32d7].