sochix / TLSharp

Telegram client library implemented in C#
1k stars 380 forks source link

Issue with TLRequestDeleteContact #820

Open lilo73 opened 5 years ago

lilo73 commented 5 years ago

client.SendRequestAsync<TLRequestDeleteContact>(req); expected return object is not TLRequestDeleteContact. It is TLLink. This causes an exception to be raised.

nimix3 commented 5 years ago

Cast it to correct expected object and use try catch for any problem or malformed object in deserialize part!

try{ var dlcont = new TLRequestDeleteContact() { Id = new TLInputUser() { AccessHash = User.AccessHash.Value, UserId = User.Id }, }; var Res = await Client.SendRequestAsync<TLLink>(dlcont); } ...