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

Uncatched exception on the newest version #955

Open
NektoDron opened this issue Dec 25, 2021 · 11 comments
Open

Uncatched exception on the newest version #955

NektoDron opened this issue Dec 25, 2021 · 11 comments

Comments

@NektoDron
Copy link

13:07:13.31[2]FATAL:UnobservedTaskException: AggregateException:
InvalidOperationException:The WebSocket is not connected.:Exception:

The WebSocket is not connected.

System.InvalidOperationException

Stack Trace:
at System.Net.WebSockets.ClientWebSocket.get_ConnectedWebSocket()
at CryptoExchange.Net.Sockets.CryptoExchangeWebSocketClient.ReceiveLoopAsync()

13:09:03.17[2]FATAL:UnobservedTaskException: AggregateException:
ObjectDisposedException:Cannot access a disposed object.
Object name: 'SecureString'.:Exception:

Cannot access a disposed object.
Object name: 'SecureString'.

System.ObjectDisposedException

Stack Trace:
at System.Security.SecureString.EnsureNotDisposed()
at CryptoExchange.Net.ExtensionMethods.GetString(SecureString source)
at Binance.Net.BinanceAuthenticationProvider.AddAuthenticationToHeaders(String uri, HttpMethod method, Dictionary2 parameters, Boolean signed, HttpMethodParameterPosition parameterPosition, ArrayParametersSerialization arraySerialization) at CryptoExchange.Net.RestClient.ConstructRequest(Uri uri, HttpMethod method, Dictionary2 parameters, Boolean signed, HttpMethodParameterPosition parameterPosition, ArrayParametersSerialization arraySerialization, Int32 requestId, Dictionary2 additionalHeaders) at CryptoExchange.Net.RestClient.SendRequestAsync[T](Uri uri, HttpMethod method, CancellationToken cancellationToken, Dictionary2 parameters, Boolean signed, Boolean checkResult, Nullable1 parameterPosition, Nullable1 arraySerialization, Int32 credits, JsonSerializer deserializer, Dictionary`2 additionalHeaders)
at Binance.Net.SubClients.Spot.BinanceClientSpotSystem.GetServerTimeAsync(Boolean resetAutoTimestamp, CancellationToken ct)

13:09:19.26[2]FATAL:UnobservedTaskException: AggregateException:
ObjectDisposedException:The CancellationTokenSource has been disposed.:Exception:

The CancellationTokenSource has been disposed.

System.ObjectDisposedException

Stack Trace:
at CryptoExchange.Net.Sockets.CryptoExchangeWebSocketClient.SendLoopAsync()

@kamranhuseyns
Copy link

Hi . You have to set your ApiKey

@NektoDron
Copy link
Author

Hi, it was set. It happens if connection was lost

@JKorf
Copy link
Owner

JKorf commented Dec 27, 2021

Hi, is this with alpha1 or alpha2?

@NektoDron
Copy link
Author

release 7.2.6
execution - net 6.0

@JKorf
Copy link
Owner

JKorf commented Jan 14, 2022

Do you have any additional logging? Do you have any connectionlost/restored handling?

@NektoDron
Copy link
Author

Additional logging was disabled. Connectionlost/restored handling has only SubscribeToUserDataUpdatesAsync stream. if connection lost will be initiated full reconnection (new BinanceSocketClient will be created).

@JKorf
Copy link
Owner

JKorf commented Jan 14, 2022

Can you show me how that code works?

@NektoDron
Copy link
Author

It disposes the BinanceClient and BinanceSocketClient and makes new instances.

@JKorf
Copy link
Owner

JKorf commented Feb 14, 2022

You're disposing the socket client in the ConnectionLost event? I can imagine that doesn't work. Any reason you're not using the default reconnect handling?

@NektoDron
Copy link
Author

Because it was written before reconnection handling appeared, and worked fine some years.

@NektoDron
Copy link
Author

And it disposed not on ConnectionLost. It disposed if some abnormal error was happened. For example, invalid listen key in KeepAliveUserStreamAsync call.

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

No branches or pull requests

3 participants