This repository was archived by the owner on Dec 5, 2021. It is now read-only.

Description
assume i use the following code:
private async Task<TelegramClient> NewClient()
{
try
{
if (_client == null)
_client = new TelegramClient(_apiId, _apiHash, _sessionStore);
if (!_client.IsConnected)
await _client.ConnectAsync();
return _client;
}
catch (MissingApiConfigurationException ex)
{
throw new Exception($"Please add your API settings to the `app.config` file. (More info: {MissingApiConfigurationException.InfoUrl})",
ex);
}
}
When it enter the state in which the _client is null, i create a new instance of the client...
so after that i check for IsConnected, so if the session was existed and it somehow got disconnected, i do a reconnecting process, but the issue is it always return true as the value of _client.IsConnected so the code won't run and any action afterward generates exception, or it make it to run all the time.