'Facing a serialization issue after updating to .net 6
I'm facing the weirdest error after updating to .net 6 (I don't even know if .net 6 have anything to do with that) I have the following class in which I'm receiving the entities as query params
public class GetEntities : IQuery<PagedResponse<EntityResponseModel>>
{
public Guid EntityId { get; set; }
public int? Take { get; set; }
public int? Skip { get; set; }
}
So I'm trying to call the endpoint using the following Url:
https://localhost:5002/api/{entityId}/users?skip=0&take=100
Which was working fine before, but suddenly started to throw the following error:
An exception has occured while handling a query. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.skip | LineNumber: 0 | BytePositionInLine: 60. ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number.
Note: When not sending any skip, take values, everything is working fine. But when setting values such as 0 and 100, it's throwing the error.
So anyone have any idea why this error suddenly started to occur? Is it a serialization issue or what?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
