gave92/fbchat-sharp

FetchThreadList() returns null

jmbits opened this issue · 3 comments

I was following the examples, but I receive the following exception:

System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null.
Source=System.Private.CoreLib
StackTrace:
at System.String.Replace(String oldValue, String newValue)
at fbchat_sharp.API.GraphQL_JSON_Decoder.graphql_to_thread(JToken thread)
at fbchat_sharp.API.Client.<>c.b__62_0(JToken node)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at fbchat_sharp.API.Client.d__62.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

Any idea why this is happening?

Hello thanks for reporting this, I'll look into it when I can.
In the meantime you can edit the library code yourself if you want.
The offending line should be

last_name: user["name"]?.Value<string>()?.Replace(user["short_name"]?.Value<string>(), "")?.Trim(),

Something like this might do:
last_name: user["short_name"]?.Value<string>() != null ? user["name"]?.Value<string>()?.Replace(user["short_name"]?.Value<string>(), "")?.Trim() : "",

Fixed in a4e19e3
Let me know if it works

It is working. Thanks a lot!