lex.db icon indicating copy to clipboard operation
lex.db copied to clipboard

ArgumentException when using 3 member index on iOS.

Open emanuelpalm opened this issue 10 years ago • 2 comments

While running code equivalent to that below on iOS, an ArgumentException is thrown with the message:

method return type is incompatible

The code that causes the error is equivalent to the below pseudocode, with the exception being thrown as a response to the invocation of WithIndex. Using the WithIndex method with only two arguments work as expected.

var database = new DbInstance(path, "");
database
    .Map<SomeClass>()
    .Automap(i => i.Key)
    .WithIndex("some-index", i => i.Name, i => i.Color, i => i.Size);
database.Initialize();

While searching through the Lex.Db source code, I found the following line of particular interest. It looks like a classical typo bug, with member2 being used to produce a value for getter3.

emanuelpalm avatar Feb 11 '16 12:02 emanuelpalm

I just tried to change the line and see if it fixed the problem, but since I'm on a Mac and Xamarin Studio doesn't seem to like the Lex.Db solution, I can't verify anything.

emanuelpalm avatar Feb 11 '16 12:02 emanuelpalm

Yes. This is the one …

From: Emanuel Palm [mailto:[email protected]] Sent: Thursday, February 11, 2016 1:25 PM To: demigor/lex.db [email protected] Subject: [lex.db] ArgumentException when using 3 member index on iOS. (#40)

While running code equivalent to that below on iOS, an ArgumentException is thrown with the message:

method return type is incompatible

The code that causes the error is equivalent to the below pseudocode, with the exception being thrown as a response to the invocation of WithIndex. Using the WithIndex method with only two arguments work as expected.

var database = new DbInstance(path, ""); database .Map<SomeClass>() .Automap(i => i.Key) .WithIndex("some-index", i => i.Name, i => i.Color, i => i.Size); database.Initialize();

While searching through the Lex.Db source code, I found the following line https://github.com/demigor/lex.db/blob/58f952148847d4e14e168b59badbb9b17a082642/lib/Lex.Db.Shared/Db/DbTable.cs#L558 of particular interest. It looks like a classical typo bug, with member2 being used to produce a value for getter3.

— Reply to this email directly or view it on GitHub https://github.com/demigor/lex.db/issues/40 . https://github.com/notifications/beacon/ACo4IWM-oycFJ5b6oItR3BmogCuVvTGCks5pjHUlgaJpZM4HYG4D.gif

demigor avatar Feb 11 '16 14:02 demigor