Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BalanceTransactionService.ListAutoPaging Null Reference Exception #1717

Closed
davetheunissen opened this issue Jul 23, 2019 · 8 comments · Fixed by #1718
Closed

BalanceTransactionService.ListAutoPaging Null Reference Exception #1717

davetheunissen opened this issue Jul 23, 2019 · 8 comments · Fixed by #1718

Comments

@davetheunissen
Copy link

davetheunissen commented Jul 23, 2019

When using the ListAutoPaging feature for BalanceTransactions, the service throws a null reference exception as it tries to go past the number of records in the result set.

i.e. the default option is to limit the returned result set to 10 records.
if I run the following, 10 records will be added to my list and the loop will throw the exception when trying to access an 11th record.

foreach (var balanceTransaction in _balanceTransactionService.ListAutoPaging())
{
      balanceTransactions.Add(balanceTransaction);
}

OSVersion: Windows 10 : Build 17134
.NETVersion : dotnet core 2.1
StripeVersion: 27.16.0

@ob-stripe
Copy link
Contributor

Hi @davetheunissen. Can you share the full stacktrace for the exception?

@davetheunissen
Copy link
Author

davetheunissen commented Jul 23, 2019

Here you go... We are getting the same exception for charges as well.

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Stripe.net
  StackTrace:
   at Stripe.Service`1.<ListRequestAutoPaging>d__24`1.MoveNext()
   at Services.Stripe.StripeBalanceTransactionService.ListBalanceTransactions(BalanceTransactionListOptions balanceTransactionListOptions) in Services\Stripe\StripeBalanceService .cs:line 35
   at RIBS.StripeTestHarness.Controllers.BalanceController.List(String payoutId) in Controllers\BalanceController .cs:line 36
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()

@ob-stripe
Copy link
Contributor

Thanks! I think I know what the bug is. I'll update here once I confirm or if I need more information.

@ob-stripe
Copy link
Contributor

Actually, can you try the following? It will help me confirm if the issue is what I think it is:

var options = new BalanceTransactionListOptions();
foreach (var balanceTransaction in _balanceTransactionService.ListAutoPaging(options))
{
      balanceTransactions.Add(balanceTransaction);
}

@davetheunissen
Copy link
Author

Hi @ob-stripe, confirmed the issue is caused by a null options object even though the LastAutoPaging method has a default parameter for the options that accept nulls.

@ob-stripe
Copy link
Contributor

Thanks @davetheunissen! We will release a fix soon.

@ob-stripe
Copy link
Contributor

We just released version 27.16.1 which should fix the issue. Thanks for the report, and sorry for the inconvenience!

@davetheunissen
Copy link
Author

Awesome thank you for the super quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants