Closed bcwood closed 1 year ago
I can't reproduce the bug, I think I will need more details
it seems that de Discoverable property isn't optional, and it exists since Mastodon v3.1.0 (https://docs.joinmastodon.org/entities/Account/#discoverable)
Could you check if your instance version or the account's one is older than that ?
Also, I tried making some other null property non-nullable, and it seems that Newtonsoft defaults it to false instead of throwing an Exception. Do you have a global Newtonsoft.Json settings that would force a strict deserialization ?
Anyway, I added a DefaultValueHandling = DefaultValueHandling.Populate
on the property, maybe it will solve the problem.
Could you test it with the preview nuget package ?
https://www.nuget.org/packages/Mastonet/2.0.1-preview-2022-11-23-1
Let me pull down the code locally and see if I can get a clearer reproduction (at the very least, find a specific account that it fails on).
I do not have any global Newtonsoft.Json settings set.
I'll also try the preview nuget package and let you know how that goes.
Here's an account I was able to recreate this issue with. discoverable
is null. That particular instance is running version 4.0.2.
"account":{
"id":"83473",
"username":"sicetsimpliciter",
"acct":"sicetsimpliciter",
"display_name":"BIBLIOTECA POSSIBILE",
"locked":false,
"bot":true,
"discoverable":null,
"group":false,
"created_at":"2018-10-27T00:00:00.000Z",
"note":"\u003cp\u003eBiblioteca Possibile è una collana di libri immaginari. Le copertine sono generate da un bot che simula la Piccola Biblioteca Adelphi con colori Caran d\u0026#39;Ache.\u003c/p\u003e",
"url":"https://botsin.space/@sicetsimpliciter",
"avatar":"https://files.botsin.space/accounts/avatars/000/083/473/original/6e4430777208a038.jpg",
"avatar_static":"https://files.botsin.space/accounts/avatars/000/083/473/original/6e4430777208a038.jpg",
"header":"https://files.botsin.space/accounts/headers/000/083/473/original/f4e7ed0b3aafd5a6.jpg",
"header_static":"https://files.botsin.space/accounts/headers/000/083/473/original/f4e7ed0b3aafd5a6.jpg",
"followers_count":154,
"following_count":16,
"statuses_count":96321,
"last_status_at":"2022-11-23",
"noindex":true,
"emojis":[
],
"fields":[
{
"name":"Coded by",
"value":"\u003ca href=\"http://www.riccardocrosa.it/biblioteca-possibile/\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"\u003e\u003cspan class=\"invisible\"\u003ehttp://www.\u003c/span\u003e\u003cspan class=\"ellipsis\"\u003ericcardocrosa.it/biblioteca-po\u003c/span\u003e\u003cspan class=\"invisible\"\u003essibile/\u003c/span\u003e\u003c/a\u003e",
"verified_at":null
}
]
}
The preview nuget package does not fix this issue. I can recreate this pretty consistently by running GetPublicTimeline()
on the botsin.space instance.
According to the Mastodon API documentation, discoverable
is a nullable field:
https://docs.joinmastodon.org/entities/Account/#discoverable
My bad ! 😅 I was looking for the "optional", I didn't see it was "nullable".
I made it nullable, it should be better now https://www.nuget.org/packages/Mastonet/2.0.1-preview-2022-11-23-2
That appears to have done the trick, as I (so far) have been unable to recreate the issue after pointing at the new preview version.
Thanks!
I just discovered a similar issue with the property last_status_at
(also nullable):
https://docs.joinmastodon.org/entities/Account/#last_status_at
The fix has been deployed to Nuget https://www.nuget.org/packages/Mastonet/2.0.1
Had a very similar issue along these lines:
Error converting value {null} to type 'System.Double'. Path 'media_attachments[0].meta.focus.y', line 1, position 3761.
I'm getting an intermittent error when calling
GetPublicTimeline()
, which appears to be related to the fieldAccount.Discoverable
being null in same cases.