question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sample code not working

See original GitHub issue

Hello,

I was trying tdsharp for the first time and seem to struggle in the early stages already. Actually I can not get the sample (TDLib.Samples.GetChats) to work even.

Everything seems to work fine for me about authorization and getting the list of chats in the line (got my apikey, hash, etc.) : var chats = await _client.ExecuteAsync(new TdApi.GetChats { OffsetOrder = offsetOrder, Limit = limit, OffsetChatId = offsetId });

I get the result and see the list of ids, so up to here everything seems to be good. However once trying to get a chat via: var chat = await _client.ExecuteAsync(new TdApi.GetChat { ChatId = chatId }); the code never returns and hangs indefinitely.

When I set _client.Bindings.SetLogVerbosityLevel(4) I can see that actually the chat-object is received in the console log (e.g. see the chat data like Title and the last message text), howver the code doesnt return on the await and the log then starts to show this and keeps repeating forever:

[ 3][t 0][1618689825.941023350][Client.cpp:276][&td_requests]   End to wait for updates, returning object 4 00000213F9649BC0
[ 3][t 0][1618689825.947626352][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 0.100000
[ 3][t 0][1618689826.055353165][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0000000000000000
[ 3][t 0][1618689826.055695534][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 0.100000
[ 3][t 0][1618689826.167449713][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0000000000000000
[ 3][t 0][1618689826.167587996][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 0.100000
[ 3][t 0][1618689826.275973558][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0000000000000000
[ 3][t 0][1618689826.276258945][Client.cpp:270][&td_requests]   Begin to wait for updates with timeout 0.100000
[ 3][t 0][1618689826.386847734][Client.cpp:276][&td_requests]   End to wait for updates, returning object 0 0000000000000000

I set my project to use .NET Core 3.0 and added via nuget: TDLib TDLib.Api tdlib.native

As it is an official sample I guess the code is fine and my project settings/references might be wrong… but as the connecting part and getting the chatlist result just fine, I can’t figure out what the problem might be.

(the code tested is 100% the sample code with just my authorization details added)

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
x2boolcommented, May 26, 2021

The most likely reason the sample project does not work for you is that you’ve installed tdlib.native 1.6 into that project. That means for now we have the following options:

  1. Use 1.7 tdsharp and compile https://github.com/tdlib/td/tree/v1.7.0 yourself. (exactly that tagged version)
  2. Use 1.6 for both and hope Telegram guys didn’t break it and still support that
  3. Use Generator to generate latest API and compile tdsharp yourself + compile tdlib
  4. (Best option) Help and contribute to https://github.com/ForNeVeR/tdlib.native/issues/34 . Then we can generate compatible versions from single commit of tdlib.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can you give me an example of a code that is not working?
When someone says "this code is not working," it usually means that the computer code ... No, you cannot get the source code...
Read more >
Not sure why this code doesn't work - simplest example I ...
After testing your code line by line, it comes down to the default case. For some reason the SCT is seeing the word...
Read more >
What to do if the code doesn't work?
Check if the program behaves correctly given the input that hits constraints in all possible senses.
Read more >
Troubleshooting your code - Coding: a Practical Guide
On this page we've collected together some tips and suggestions for when you're having problems coding: when your code doesn't work or you...
Read more >
Sample Code not working
After trying out the tutorial I noticed there was a syntax error in the SampleTest.js file for the tutorial (which will be fixed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found