{"action":"created","issue":{"url":"https://api.github.com/repos/sonvister/Binance/issues/65","repository_url":"https://api.github.com/repos/sonvister/Binance","labels_url":"https://api.github.com/repos/sonvister/Binance/issues/65/labels{/name}","comments_url":"https://api.github.com/repos/sonvister/Binance/issues/65/comments","events_url":"https://api.github.com/repos/sonvister/Binance/issues/65/events","html_url":"https://github.com/sonvister/Binance/issues/65","id":299909704,"number":65,"title":"0.2.0-alpha35: Exceptions Raised when Cancelling token for Aggregate Trade Socket","user":{"login":"rakewell","id":35868094,"avatar_url":"https://avatars1.githubusercontent.com/u/35868094?v=4","gravatar_id":"","url":"https://api.github.com/users/rakewell","html_url":"https://github.com/rakewell","followers_url":"https://api.github.com/users/rakewell/followers","following_url":"https://api.github.com/users/rakewell/following{/other_user}","gists_url":"https://api.github.com/users/rakewell/gists{/gist_id}","starred_url":"https://api.github.com/users/rakewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakewell/subscriptions","organizations_url":"https://api.github.com/users/rakewell/orgs","repos_url":"https://api.github.com/users/rakewell/repos","events_url":"https://api.github.com/users/rakewell/events{/privacy}","received_events_url":"https://api.github.com/users/rakewell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"rakewell","id":35868094,"avatar_url":"https://avatars1.githubusercontent.com/u/35868094?v=4","gravatar_id":"","url":"https://api.github.com/users/rakewell","html_url":"https://github.com/rakewell","followers_url":"https://api.github.com/users/rakewell/followers","following_url":"https://api.github.com/users/rakewell/following{/other_user}","gists_url":"https://api.github.com/users/rakewell/gists{/gist_id}","starred_url":"https://api.github.com/users/rakewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakewell/subscriptions","organizations_url":"https://api.github.com/users/rakewell/orgs","repos_url":"https://api.github.com/users/rakewell/repos","events_url":"https://api.github.com/users/rakewell/events{/privacy}","received_events_url":"https://api.github.com/users/rakewell/received_events","type":"User","site_admin":false},"assignees":[{"login":"rakewell","id":35868094,"avatar_url":"https://avatars1.githubusercontent.com/u/35868094?v=4","gravatar_id":"","url":"https://api.github.com/users/rakewell","html_url":"https://github.com/rakewell","followers_url":"https://api.github.com/users/rakewell/followers","following_url":"https://api.github.com/users/rakewell/following{/other_user}","gists_url":"https://api.github.com/users/rakewell/gists{/gist_id}","starred_url":"https://api.github.com/users/rakewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakewell/subscriptions","organizations_url":"https://api.github.com/users/rakewell/orgs","repos_url":"https://api.github.com/users/rakewell/repos","events_url":"https://api.github.com/users/rakewell/events{/privacy}","received_events_url":"https://api.github.com/users/rakewell/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2018-02-24T04:09:49Z","updated_at":"2018-02-25T05:28:51Z","closed_at":null,"author_association":"NONE","body":"I seem to be getting a few exceptions when unsubscribing Aggregate Trade Updates. These exceptions are not propagated to the client and therefore do not get trapped by the client, they are just simply swallowed by the runtime. The reason I bring this up is because on one occasion, when the function ran to Unsubscribe and the Re-subscribe (because I needed to add another symbol to the subscription), the aggregate trade socket stopped sending trade updates even though the socket was still connected. The logs didn't show any errors or anything unusual. I can only suspect that it was something to do with the unhandled exceptions below. These exceptions always get raised whenever the unsubscribing takes place. Off course, the cancel exceptions are expected but I'm not sure if the other ones are interfering with the socket when re-subscription takes place.  I have tried to add more information to the exceptions by making the runtime break and then copy the details (these are in brackets), see below.\r\n\r\nhere is the unsubscribing code:\r\n\r\n```\r\n    Private Sub UnSubscibeAllTradeUpdatesManaged()\r\n        If Me.m_BinanceAggregateTradeSocketCancel IsNot Nothing Then\r\n\r\n            Me.m_BinanceAggregateTradeSocketCancel.Cancel() 'this will cancel all streams \r\n\r\n            Me.m_BinanceAggregateTradeSocketCancel.Dispose()\r\n            Me.m_BinanceAggregateTradeSocketCancel = Nothing\r\n\r\n            Me.m_BinanceAggregateTradeSocketManager.Unsubscribe()\r\n\r\n        End If\r\n    End Sub\r\n```\r\n\r\n\r\nhere is the initialisation code for the AggregateTradeSocket:\r\n\r\n```\r\n        Dim AggregateTradeSocketLoggerFactory As ILoggerFactory = New Microsoft.Extensions.Logging.LoggerFactory()\r\n        AggregateTradeSocketLoggerFactory.AddFile(\"logs/Binance/\" & Me.m_TradingAccountID & \" Aggregate Trade Socket - ApiLogger Debug.\" & Date.Now.ToSortableDate & \".txt\", LogLevel.Trace)\r\n\r\n        'initialise Stream  & loggers      \r\n        Dim AggregateTradeSocketStreamClientLogger As New Logger(Of DefaultWebSocketClient)(AggregateTradeSocketLoggerFactory)\r\n        Dim AggregateTradeWebSocketStreamLogger As New Logger(Of BinanceWebSocketStream)(AggregateTradeSocketLoggerFactory)\r\n\r\n        Me.m_BinanceAggregateTradeSocketClient = New DefaultWebSocketClient(AggregateTradeSocketStreamClientLogger)\r\n        Me.m_BinanceAggregateTradeSocketStream = New BinanceWebSocketStream(m_BinanceAggregateTradeSocketClient, AggregateTradeWebSocketStreamLogger)\r\n\r\n\r\n        'initialise objects for the AggregateTradeDataWebSocketClientManager & loggers\r\n        Dim BinanceAggregateTradeSocketManagerLogger As New Logger(Of AggregateTradeWebSocketClientManager)(AggregateTradeSocketLoggerFactory)\r\n        Dim BinanceAggregateTradeClientLogger As New Logger(Of AggregateTradeClient)(AggregateTradeSocketLoggerFactory)\r\n\r\n        Me.m_BinanceAggregateTradeClient = New AggregateTradeClient(BinanceAggregateTradeClientLogger)\r\n        Me.m_BinanceAggregateTradeStreamController = New BinanceWebSocketStreamController(Me.m_BinanceApi, m_BinanceAggregateTradeSocketStream, AddressOf BinanceAggregateTradeStreamControllerExceptionHandler)\r\n        Me.m_BinanceAggregateTradeSocketManager = New AggregateTradeWebSocketClientManager(m_BinanceAggregateTradeClient, m_BinanceAggregateTradeStreamController, BinanceAggregateTradeSocketManagerLogger)\r\n\r\n        AddHandler Me.m_BinanceAggregateTradeSocketClient.Close, AddressOf Me.m_BinanceSocketAggregateTradeStreamClient_Close\r\n        AddHandler Me.m_BinanceAggregateTradeSocketClient.Open, AddressOf Me.m_BinanceSocketAggregateTradeStreamClient_Open\r\n\r\n        AddHandler Me.m_BinanceAggregateTradeSocketClient.Message, AddressOf Me.m_BinanceAggregateTradeStreamClient_Message\r\n```\r\n\r\nhere are the exceptions called every time an unsubscription takes place\r\n```\r\n\r\nException thrown: 'System.ObjectDisposedException' in System.dll\r\n(System.ObjectDisposedException: 'Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket'.')\r\n\r\nException thrown: 'System.IO.IOException' in System.dll\r\n(: 'Unable to read data from the transport connection: Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket'..')\r\n\r\nException thrown: 'System.ObjectDisposedException' in System.dll\r\nException thrown: 'System.ObjectDisposedException' in System.dll\r\nException thrown: 'System.ObjectDisposedException' in mscorlib.dll\r\nException thrown: 'System.OperationCanceledException' in mscorlib.dll\r\nException thrown: 'System.OperationCanceledException' in mscorlib.dll\r\nException thrown: 'System.OperationCanceledException' in mscorlib.dll\r\nException thrown: 'System.OperationCanceledException' in System.dll\r\nException thrown: 'System.OperationCanceledException' in mscorlib.dll\r\nException thrown: 'System.Threading.Tasks.TaskCanceledException' in mscorlib.dll\r\nException thrown: 'System.Threading.Tasks.TaskCanceledException' in Binance.dll\r\nException thrown: 'System.Threading.Tasks.TaskCanceledException' in mscorlib.dll\r\n\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/sonvister/Binance/issues/comments/368284770","html_url":"https://github.com/sonvister/Binance/issues/65#issuecomment-368284770","issue_url":"https://api.github.com/repos/sonvister/Binance/issues/65","id":368284770,"user":{"login":"rakewell","id":35868094,"avatar_url":"https://avatars1.githubusercontent.com/u/35868094?v=4","gravatar_id":"","url":"https://api.github.com/users/rakewell","html_url":"https://github.com/rakewell","followers_url":"https://api.github.com/users/rakewell/followers","following_url":"https://api.github.com/users/rakewell/following{/other_user}","gists_url":"https://api.github.com/users/rakewell/gists{/gist_id}","starred_url":"https://api.github.com/users/rakewell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rakewell/subscriptions","organizations_url":"https://api.github.com/users/rakewell/orgs","repos_url":"https://api.github.com/users/rakewell/repos","events_url":"https://api.github.com/users/rakewell/events{/privacy}","received_events_url":"https://api.github.com/users/rakewell/received_events","type":"User","site_admin":false},"created_at":"2018-02-25T05:28:51Z","updated_at":"2018-02-25T05:28:51Z","author_association":"NONE","body":"as mentioned in the opening post only because there was a fault with the aggregate stream but I think that it might have something to do with unsubscribe/resubscribe."}}
{"actor":{"display_login":"rakewell"}}