burakoner / OKX.Api

Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible OKX Cryptocurrency Exchange Rest and Websocket Api Wrapper
MIT License
39 stars 15 forks source link

ApiSharp exception crashes app #52

Closed Radimersky closed 9 months ago

Radimersky commented 9 months ago

On 1.5.0 and 1.5.1 versions of OKX.API I have started experiencing a bug that crashes my app. I don't know what makes the app crash, because It happens randomly after using your package to trade on OKX for a while. All I get is this stack trace:

Unhandled exception. System.AggregateException: One or more errors occurred. (Collection was modified; enumeration operation may not execute.) ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.Generic.Queue1.Enumerator.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable1 source, Int32& length) at System.Collections.Generic.Queue1..ctor(IEnumerable`1 collection) at ApiSharp.Models.AsyncResetEvent.<>c__DisplayClass5_0.b__0() in E:\Github\ApiSharp\ApiSharp\Models\AsyncResetEvent.cs:line 51 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException) --- End of inner exception stack trace --- at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException) at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool) at System.Threading.TimerQueue.FireNextTimers() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

Only this OKX.Api package uses ApiSharp in my app, so the issue must come from there.

burakoner commented 9 months ago

I've fixed this issue today on ApiSharp side. I'll release new version of OKX.Api tonight. Thanks for feedback

forReason commented 9 months ago

thank god