Visual Studio for Mac, Mono 5 and SQLite: a new mess

EnricoRossiniEnricoRossini USMember ✭✭✭

Hi guys,
there is an issue. I installed Visual Studio for Mac and then I re-compiled my project and deploy it yesterday. Today nobody can save new record in the database with sqlite. I didn't change anything apart from Visual Studio. Basically when I save a record an error always occurs on Insert

    public int SaveItem<T>(T item) where T : ITableEntity
    {
        int rtn = 0;

        lock (locker)
        {
            try
            {
                if (item.Id != 0)
                {
                    database.Update(item);
                    rtn = item.Id;
                }
                else
                {
                    rtn = database.Insert(item);
                }
            }
            catch (Exception ex)
            {
            }
        }

        return rtn;
    }

An item with the same key has already been added.

But it's a new record.

The complete error is

at System.ThrowHelper.ThrowArgumentException (System.ExceptionResource resource) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/throwhelper.cs:72
at System.Collections.Generic.Dictionary2[TKey,TValue].Insert (TKey key, TValue value, System.Boolean add) [0x0007c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:336 at System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:192
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (TSource[] source, System.Func2[T,TResult] keySelector, System.Func2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer1[T] comparer) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:163 at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] keySelector, System.Func2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer1[T] comparer) [0x00051] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:139 at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] keySelector, System.Func2[T,TResult] elementSelector) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.33/src/mono/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:106
at SQLite.EnumCacheInfo..ctor (System.Type type) [0x00022] in /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:2033
at SQLite.EnumCache.GetInfo (System.Type type) [0x00024] in /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:2066
at SQLite.SQLiteCommand.BindParameter (SQLitePCL.sqlite3_stmt stmt, System.Int32 index, System.Object value, System.Boolean storeDateTimeAsTicks) [0x001c6] in /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:2431
at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery (System.Object[] source) [0x0003d] in /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:2562
at SQLite.SQLiteConnection.Insert (System.Object obj, System.String extra, System.Type objType) [0x0010e] in /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:1381
at SQLite.SQLiteConnection.Insert (System.Object obj) [0x00008] in /Users/fak/Dropbox/Projects/sqlite-net/src/SQLite.cs:1224
at myInventories.Repository.InventoriesDatabase.SaveItem[T] (T item) [0x0005b] in <75e1ff99a68545aa8a5820d9255ead1c>:0

If I change the runtime as explain in my post the error still there.

Best Answer

  • EnricoRossiniEnricoRossini USMember ✭✭✭
    Accepted Answer

    Ok, SQLite is been updated in a couple of projects. I removed all references and reinstall it from nuget and now my solution is working.

Answers

  • EnricoRossiniEnricoRossini USMember ✭✭✭
    Accepted Answer

    Ok, SQLite is been updated in a couple of projects. I removed all references and reinstall it from nuget and now my solution is working.

Sign In or Register to comment.