Serialization Error

Am getting the below from a fairly simple call to OrmLite: (latest 5.8.0, core 3.0). LMOrder has one complex type, the JSON in that column looks to be valid.

public object Any(getLatestOrdersRequest req)

            var daysback = req.DaysBack <= 0 ? 30 : req.DaysBack;

            using (var c = dbConnectionFactory.OpenDbConnection())

                return c.Select<LMOrder>(x => x.created_at > DateTime.Now.AddDays(-1 * daysback));


System.ArgumentNullException: Value cannot be null. (Parameter ‘value’)
at ServiceStack.Text.Tracer.NullTracer.WriteError(Exception ex) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Tracer.cs:line 23
at ServiceStack.Text.Common.WriteListsOfElements2.WriteGenericIList(TextWriter writer, IList1 list) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 301
at ServiceStack.Text.JsonSerializer.SerializeToStream(Object value, Type type, Stream stream) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\JsonSerializer.cs:line 180
at ServiceStack.Text.JsonSerializer.SerializeToStream[T](T value, Stream stream) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\JsonSerializer.cs:line 172
at ServiceStack.Serialization.JsonDataContractSerializer.SerializeToStream[T](T obj, Stream stream) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack.Client\Serialization\JsonDataContractSerializer.cs:line 64
at ServiceStack.Host.ContentTypes.<>c.<.ctor>b__38_0(IRequest r, Object o, Stream s) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Host\ContentTypes.cs:line 20
at ServiceStack.Host.ContentTypes.serializeSync(StreamSerializerDelegate serializer, IRequest httpReq, Object dto, Stream stream) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\Host\ContentTypes.cs:line 262
at ServiceStack.HttpResponseExtensionsInternal.WriteToResponse(IResponse response, Object result, StreamSerializerDelegateAsync defaultAction, IRequest request, Byte[] bodyPrefix, Byte[] bodySuffix, CancellationToken token) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\HttpResponseExtensionsInternal.cs:line 335

Please provide a Minimal Reproducible Example I can run locally to repro the issue.

I sadly do not have time to do that… but I did find it was related to a read only (get{} only) property that I had added. I tried [Ignore] to no avail. I’m able to move on with my project for now.

Ok in future when reporting issues please provide enough info so the issue can be reproduced. This code fragment isn’t relevant to the issue reported, which is likely due to invalid serialization of your JSON blob.

Note: you can use Db in your Services to query OrmLite, e.g:

Db.Select<LMOrder>(x => x.created_at > DateTime.Now.AddDays(-1 * daysback));