Skip to content

System.ArgumentNullException: Value cannot be null. (Parameter 'source') in CancelFuturesOrderByClientOrderIdAsync #96

@EricGarnier

Description

@EricGarnier

Hi Jan,
I recently bump into an exception while using the CancelFuturesOrderByClientOrderIdAsync method on IFuturesOrderClientIdRestClient

Below is the stack trace, but unfortunately, I didn't collect the exchange with the place.

Looking into the code, I suspect that is because CoinEx responded with a null Data, and the line
return order.AsExchangeResult(Exchange, request.Symbol!.TradingMode, new SharedId(order.Data.FirstOrDefault()?.Data?.Id.ToString() ?? request.OrderId));
crashed on the FirstOrDefault.
Maybe you could protect the code for this case ?

In any way, this is not a hurry for me.

Thanks for all your efforts.

Eric

System.ArgumentNullException: Value cannot be null. (Parameter 'source')                                                       at
 System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument) + 0x34                                         at
 System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1, Boolean&) + 0x20                                          at
 CoinEx.Net.Clients.FuturesApi.CoinExRestClientFuturesApi.<CryptoExchange-Net-SharedApis-IFuturesOrderClientIdRestClient-CancelFuturesOrderByClientOrderIdAsync>d__123.MoveNext() + 0x1ea          

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions