FastDeserializer raises ArgumentOutOfRangeException when trying to deserialize a rest binary content response

Posts   
 
    
jhonheavy
User
Posts: 3
Joined: 16-Dec-2020
# Posted on: 16-Dec-2020 22:47:58   

So, I was really frustrated with this issue because I don't really know what is going on. For the first part I have already created tests that certifies that the FastDeserializer is working perfectly even when I put the byte array inside a ByteArrayContent in a HttpResponseMessage, getting the content with the ReadAsByteArrayAsync() getting a simple byte[] object, that is perfect and that works. But, for some reason, if I do the same with with a REST API, when I am on the client and try to deserialize the binary content of the response I get the next exception:

System.ArgumentOutOfRangeException HResult=0x80131502 Message=Index was out of range. Must be non-negative and less than the size of the collection. Arg_ParamName_Name Source=System.Private.CoreLib StackTrace: at System.ThrowHelper.ThrowArgumentOutOfRange_IndexException() at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.ReadEntityMemberCollections(EntityBase2 entity) at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.ReadReferencedEntities(EntityBase2 rootEntity) at SD.LLBLGen.Pro.ORMSupportClasses.FastDeserializer.Deserialize(IFastSerializableEntityCollection2 collection) at VoyageViewer.Shared.Services.JsonService.<ExecuteRestBinaryGet>d__3`1.MoveNext() in D:\git\cms_uno\src\VoyageViewer\VoyageViewer\VoyageViewer.Shared\Services\JsonService.cs:line 43

So, what could I be doing wrong?. I mean, I know the FastDeserializer works, but what could happening that provoques this error on the client?.

Thanks

Jh0nh3avy
jhonheavy
User
Posts: 3
Joined: 16-Dec-2020
# Posted on: 16-Dec-2020 23:24:32   

Oh, and the client is a UWP project. I don't know specifically if that could affect this scenario.

Jh0nh3avy
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Dec-2020 07:43:19   

Hi jhon,

What LLBLGen runtime version are you using on the server-side and the client-side (the RESP API)?

David Elizondo | LLBLGen Support Team
jhonheavy
User
Posts: 3
Joined: 16-Dec-2020
# Posted on: 17-Dec-2020 16:41:54   

I have found the error and it was something dumb, due to the server being on a different branch in the repo, it has an updated version on the Entity (few fields were removed) so the client was trying to deserialize an object expecting more fields and that may be the cause of the OutOfRange exception.

Jh0nh3avy