doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
741 stars 129 forks source link

use ConfigureAwait(false) to avoid UI context synchronization #187

Closed 23W closed 3 years ago

23W commented 3 years ago

@doghappy Hi, can you please review this PR. It adds using of ConfigureAwait(false) for await operations to avoid synchronization with UI main thread context when lib is used in .Net WinForm apps.

I've found that ignoring ConfigureAwait(false) in await calls leads to freezing of lib incoming events reading when main UI context is locked for long time by UI tasks. ListenAsync inherits UI context when ConnectAsync is called from UI thread.