I have a strange issue calling a GET service with multiple ids (List).
For one service it works, but for another service ServiceStackText exception is thrown, and I cannot understand why.
This service works with multiple ids (423, 331):
https://localhost:7750/api/query/reference/counterparties?Ids=423%2C%20331
[Route("/api/query/reference/counterparties", "GET")]
public class QueryCounterparties : QueryDb<Counterparty>, IGet
{
public List<int> Ids { get; set; } = null!;
}
This service fails with multiple ids (423, 331), but is working with single id (e.g. 423 or 331):
- Works: https://localhost:7750/api/report/counterparties?CounterpartyIds=423
- Fails: https://localhost:7750/api/report/counterparties?CounterpartyIds=423%2C331
[Route("/api/report/counterparties", "GET")]
public class QueryCounterpartiesReport : IReturn<CrudResponse<CounterpartiesReport>>, IGet
{
public List<int> CounterpartyIds { get; set; } = null!;
}
400 response:
{
"result": null,
"responseStatus": {
"errorCode": "FormatException",
"message": "Input string was not in a correct format.",
"stackTrace": null,
"errors": [],
"meta": null
}
}
Stacktrace:
System.FormatException: Input string was not in a correct format.
at ServiceStack.Text.SignedInteger`1.ParseInt64(ReadOnlySpan`1 value) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.Text/src/ServiceStack.Text/DefaultMemory.cs:line 895
at ServiceStack.Text.SignedInteger`1.ParseObject(ReadOnlySpan`1 value) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.Text/src/ServiceStack.Text/DefaultMemory.cs:line 800
at ServiceStack.Text.Common.JsReader`1.<>c__DisplayClass4_0`1.<GetCoreParseStringSpanFn>b__3(ReadOnlySpan`1 value) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.Text/src/ServiceStack.Text/Common/JsReader.cs:line 69
at ServiceStack.Text.Jsv.JsvReader.<>c__DisplayClass2_0.<GetParseFn>b__0(String v) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.Text/src/ServiceStack.Text/Jsv/JsvReader.Generic.cs:line 18
at ServiceStack.Text.TypeSerializer.DeserializeFromString(String value, Type type) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.Text/src/ServiceStack.Text/TypeSerializer.cs:line 90
at ServiceStack.AutoMappingUtils.ChangeTo(String strValue, Type type) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack.Text/src/ServiceStack.Text/AutoMappingUtils.cs:line 363
at ServiceStack.TypedQuery`2.AppendUntypedQueries(SqlExpression`1 q, Dictionary`2 dynamicParams, String defaultTerm, IAutoQueryOptions options, Dictionary`2 aliases) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Server/AutoQueryFeature.cs:line 1534
at ServiceStack.TypedQuery`2.AddToQuery(ISqlExpression query, IQueryDb dto, Dictionary`2 dynamicParams, IAutoQueryOptions options, IRequest req) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Server/AutoQueryFeature.cs:line 1355
at ServiceStack.AutoQuery.CreateQuery[From](IQueryDb`1 dto, Dictionary`2 dynamicParams, IRequest req, IDbConnection db) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Server/AutoQueryFeature.cs:line 962
at ServiceStack.AutoQueryExtensions.CreateQuery[From](IAutoQueryDb autoQuery, IQueryDb`1 model, IRequest request, IDbConnection db) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack.Server/AutoQueryFeature.cs:line 1720
at ServiceInterface.ReportNs.BusinessNs.CounterpartiesReportService.GetCounterparties(List`1 counterpartyIds) in C:\Yoyo\InternalApp\Application\RPT\code\src\ServiceInterface\ReportNs\BusinessNs\CounterpartiesReportService.cs:line 66
at ServiceInterface.ReportNs.BusinessNs.CounterpartiesReportService.Get(QueryCounterpartiesReport request) in C:\Yoyo\InternalApp\Application\RPT\code\src\ServiceInterface\ReportNs\BusinessNs\CounterpartiesReportService.cs:line 28
Any ideas?
Using v8.3.1 on windows with .Net 8