tdsharp: Failed to parse JSON object as TDLib request: Unknown class "updateOption"

Hi I download current source and add tdlib.native package from nuget to TDLib.Samples.GetChats project, update ApId and ApiHash and PhoneNumber, then run. after few moments exception occurred.

TdLib.TdException: 'Failed to parse JSON object as TDLib request: Unknown class "updateOption"' latest line of output:

'TDLib.Samples.GetChats.exe' (CoreCLR: clrhost): Loaded 'Anonymously Hosted DynamicMethods Assembly'. 
Exception thrown: 'TdLib.TdException' in System.Private.CoreLib.dll
An exception of type 'TdLib.TdException' occurred in System.Private.CoreLib.dll but was not handled in user code
Failed to parse JSON object as TDLib request: Unknown class "updateOption

image : https://ibb.co/6RY8bs0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 15

Most upvoted comments

Ok, after several hours of searching, I understand that we do not need to install the options that come by update. I got a few new errors before I realized it. Here’s the timeline:

  1. Failed to parse JSON object as TDLib request: Unknown class “updateoption” - this error occurred due to overriding the datatype parameter. It is not necessary to touch it, it is a kind of class name for the json format. The Extra parameter can also be left untouched, because it is used by the library, for example, for id. You can simply delete these parameters and use the setOption method according to the documentation https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1set_option.html, passing only two parameters. After that, I started getting another error.
  2. TDLib. tdexception: “Option can’t be set” - Starting immediately with the “version” option. https://core.telegram.org/tdlib/options. According to the same documentation, the options on which such an exception was made are forbidden to write. It is logical, because we do not need to change the version of tdlib. Therefore, updateoption only informs our application about the option change or occurs during initialization. For example so that we can correctly display the current version in the corner of the app)))

I checked the documentation and it is not written anywhere in the need to set options after getting the event. And in the examples, it is often ignored in general. Solution: do not set the options that came for the event updateoption