& ldquo; ref. vs & ldquo; out & rdquo; keyword errors using the sql-net combination and C # Sqlite for the Windows 7.1 phone

advertisements

I am getting some "ref" vs "out" keyword errors using the sql-net and C# Sqlite combination for windows phone 7.1. Is this due to a wrong combination of libraries that I am using?

App Type: Windows Phone 7.1

Using:

  1. sql-net Version 1.0.5, Source Nuget thru Visual Studio
  2. C# Sqlite for WP7 (wp7sqlite) ( Community.CSharpSqlite.WP7) Version 0.1.1, Source Nuget thru Visual Studio.

The exact error I receive is below

Error 5 The best overloaded method match for Community.CsharpSqlite.Sqlite3.sqlite3_open(string, ref Community.CsharpSqlite.Sqlite3.sqlite3)' has some invalid arguments C:\Dev\Learning\SQLite.cs Line:2492 Column: 29

The next error then hints that it is related to the parameter being passed as "out" type instead of "ref" type.

Error 6 Argument 2 must be passed with the 'ref' keyword C:\Dev\Learning\SQLite.cs Line: 2492 Column: 64

I can make the compile errors go away by replacing the "out" keyword with the "ref" keyword, but that is likely to lead to other issues. Given that I do not see much complain about this issue - I may be doing something wrong but not able to detect easily.


The parameter was changed in csharp-sqlite (optionally(?) used by sqlite-net) between 3.7.6.3 and 3.7.7.1 from ref to out, see this commit (look for line 2692).

If you don't want to update your code, you will need to use the newer version of csharp-sqlite. You probably don't see many questions about this because you're one of the few using an older version for whatever reason.