OrmLite Select Method with Limit skip parameter > 0 throws ArgumentOutOfRangeException

116 views
Skip to first unread message

Alex Palma

unread,
Apr 24, 2014, 7:44:45 AM4/24/14
to servic...@googlegroups.com
using (var db = dbFactory.OpenDbConnection())
{
    list = db.Select<ClientGlobal>(q=> q.Limit(1, 100));

}
The select Command throws ArgumentOutOfRangeException if I use q.Limit(0, 100) then all works fine.
the exception has the following message and stack trace.
StartIndex cannot be less than zero.
Parameter name: startIndex
   at System.String.Remove(Int32 startIndex)
   at ServiceStack.OrmLite.SqlServer.SqlServerExpression`1.ToSelectStatement()
   at ServiceStack.OrmLite.ReadExtensions.Select[T](IDbCommand dbCmd, Func`2 expression)
   at ServiceStack.OrmLite.ReadConnectionExtensions.<>c__DisplayClass4`1.<Select>b__3(IDbCommand dbCmd)
   at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func`2 filter)
   at ServiceStack.OrmLite.ReadConnectionExtensions.Exec[T](IDbConnection dbConn, Func`2 filter)
   at ServiceStack.OrmLite.ReadConnectionExtensions.Select[T](IDbConnection dbConn, Func`2 expression)
   at Millennium.Meevo.Server.Plugins.OnlineBooking.DataAccess.ClientGlobalTest.GetClientGlobalTest() in c:\Development\Millennium\Evo-Dev\Server\Plugins\Millennium.Meevo.Server.Plugins.OnlineBooking.DataAccess\ClientGlobalTest.cs:line 19

i'm using sql server 2012 Developer

Looking into the source code was I think the error is happening in  var selectExpression = SelectExpression.Remove(SelectExpression.IndexOf("FROM")).Trim(); //0
So i'm assuming that SelectExpression at this moment is an empty string or something.

Anton Kallenberg

unread,
Apr 29, 2014, 6:30:22 AM4/29/14
to servic...@googlegroups.com
Hi,

Any solution to this? Getting the same exception in the same situation after upgrade from 4.0.10 to 4.0.18. After downgrading to 4.0.10 everything works as expected. Is this a confirmed bug?

Regards,
Anton

bara...@gmail.com

unread,
May 20, 2014, 9:26:14 PM5/20/14
to servic...@googlegroups.com
Same here, confirming the bug...

bara...@gmail.com

unread,
May 20, 2014, 9:39:08 PM5/20/14
to servic...@googlegroups.com
Actually, I pulled the latest sources, not throwing anymore.


On Thursday, April 24, 2014 9:44:45 PM UTC+10, Alex Palma wrote:
Reply all
Reply to author
Forward
0 new messages