refit icon indicating copy to clipboard operation
refit copied to clipboard

System.ArgumentOutOfRangeException: 'Specified argument was out of the range of valid values. Parameter name: index'

Open Leon99 opened this issue 7 years ago • 8 comments

        [Post("/transactions/{id}/confirm")]
        Task ConfirmTransaction(int id, [Query][AliasAs("send_to_payer")] bool sendToPayer, [Header("Authorization")] string authorization);

started to throw after updating to 4.7.51

   at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
   at Refit.RequestBuilderImplementation.<>c__DisplayClass17_0.<<BuildRequestFactoryForMethod>b__0>d.MoveNext() in d:\a\1\s\Refit\RequestBuilderImplementation.cs:line 594
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Refit.RequestBuilderImplementation.<>c__DisplayClass20_0.<<BuildVoidTaskFuncForMethod>b__0>d.MoveNext() in d:\a\1\s\Refit\RequestBuilderImplementation.cs:line 730
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   at NexPay.ClientPortal.Services.Payments.PaymentService.<ConfirmPaymentAsync>d__11.MoveNext() in

Might be related to #712 but different trigger here.

Leon99 avatar Aug 30 '19 08:08 Leon99

this exception started happening for me as well

jennablackwell avatar Sep 03 '19 15:09 jennablackwell

Hi, I see this issue as well. It happens when attempt to use as query parameters those parameters that are not specified as a URL substitution. So this code does not work [Get("api/someurl")] Task<MyClass> Call([Header(""Authorization"")] string token, string param);

This code works: [Get("api/someurl?param={param}")] Task<MyClass> Call([Header(""Authorization"")] string token, string param);

Please note that this issue is not reproduced for v4.7.9 but for 4.7.51 it's reproduced.

Leks12lk avatar Sep 09 '19 14:09 Leks12lk

It's a breaking change.

SWarnberg avatar Oct 04 '19 06:10 SWarnberg

Any progress on this? Updating a patch version from 4.7.9 to 4.7.51 broke things for us, too. If this is by design, this is a breaking change. If it's a bug, it should likely be given a higher priority.

girtsl avatar Oct 17 '19 05:10 girtsl

@benjaminhowarth1 any luck with the fix to this issue?

@SWarnberg this is not intentional, it's a bug.

@girtsl people work on this on their spare time. PR's with a fix (and appropriate tests showing the issue) are more than welcome from anyone.

clairernovotny avatar Oct 17 '19 11:10 clairernovotny

@onovotny, thanks, I'm fully aware of it. In case my previous comment came across as an arrogant one, it was not. It was merely meant as an indicator that the issue is not limited to a few obscure scenarios.

Seeing how this breaking change was discovered on August 30 and how easy it is to trip on it, I thought it would've attracted more attention from the maintainers who are in a much better position to find the cause and come up with a fix.

girtsl avatar Oct 17 '19 11:10 girtsl

Fixed by #772

clairernovotny avatar Oct 31 '19 13:10 clairernovotny

This problem is still occurring in v5.0.15

pbarrios avatar Dec 02 '19 20:12 pbarrios