JKorf / Bittrex.Net

A C# .Net wrapper for the Bittrex web API including all features easily accessible and usable
MIT License
141 stars 62 forks source link

SubscribeToOrderUpdatesAsync Failing - Microsoft.AspNet.SignalR.Client 2.4.2 Update Needed #198

Closed pspsales closed 3 years ago

pspsales commented 3 years ago

Microsoft.AspNet.SignalR.Client 2.4.1 is failing at line 215 of BittrexSocketClient.cs with: System.MissingMethodException: 'Method not found: 'Void Microsoft.AspNet.SignalR.Client.Transports.ClientTransportBase.TransportFailed(System.Exception)'.'

Updating Microsoft.AspNet.SignalR.Client 2.4.2 resolves this issue, with adjustment to Line 71 of WebsocketcustomTransport.cs due to 'TransportFailed' not existing any longer.

Re-produce error in debug mode with Await client.SubscribeToOrderUpdatesAsync(...)

JKorf commented 3 years ago

Updated the dependency in the beta release

pspsales commented 3 years ago

Thanks, I believe the actual issue relates to the buffer size of WebSockets:

The value of the 'receiveBufferSize' parameter (5242880) must be less than or equal to 65536. Parameter name: receiveBufferSize Actual value was 5242880. - at System.Net.WebSockets.WebSocketHelpers.ValidateBufferSizes(Int32 receiveBufferSize, Int32 sendBufferSize) at System.Net.WebSockets.ClientWebSocketOptions.SetBuffer(Int32 receiveBufferSize, Int32 sendBufferSize) at CryptoExchange.Net.Sockets.CryptoExchangeWebSocketClient.CreateSocket() at CryptoExchange.Net.Sockets.CryptoExchangeWebSocketClient..ctor(Log log, String url, IDictionary2 cookies, IDictionary2 headers) at CryptoExchange.Net.Sockets.CryptoExchangeWebSocketClient..ctor(Log log, String url) at Bittrex.Net.Sockets.BittrexHubConnection..ctor(Log log, ApiProxy proxy, HubConnection connection) at Bittrex.Net.Sockets.ConnectionFactory.CreateWebsocket(Log log, String url) at CryptoExchange.Net.SocketClient.CreateSocket(String address) at Bittrex.Net.BittrexSocketClient.CreateSocket(String address) at Bittrex.Net.BittrexSocketClient.GetSocketConnection(String address, Boolean authenticated) at CryptoExchange.Net.SocketClient.d43`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Bittrex.Net.BittrexSocketClient.d26`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Bittrex.Net.BittrexSocketClient.d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at xx.Form1.VB$StateMachine_149_Bittrex_SubscribeToOrderUpdates.MoveNext() in C:....Form1.vb:line xx

Error thrown at: Await Bittrex_socketClient.SubscribeToOrderUpdatesAsync(Sub(data As CryptoExchange.Net.Sockets.DataEvent(Of BittrexOrderUpdate)) DummySub())

JKorf commented 3 years ago

Interesting, it seems .net framework has a max buffer size of 64kb while dotnet core and up doesn't seem to have a hard limit for max size. Can you confirm you're using .net framework?

pspsales commented 3 years ago

Yes, to confirm I am using .NET Framework 4.7.2. When reverting to version 5.2.0 beta4: Method 'add_OnOrderPlaced' in type 'Bittrex.Net.BittrexClient' from assembly 'Bittrex.Net, Version=5.2.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation

JKorf commented 3 years ago

Can you try with CryptoExchange.Net beta 8? Just install latest version of Bittrex.Net again and additionally install CryptoExchange.Net version beta8. I've adjusted the buffer size.

pspsales commented 3 years ago

Awesome, this fixed it instantly, many thanks :) Edit - To note - only updated to CryptoExchange.Net beta 8 for this to fix.