You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using BridgeStack to write a script that goes over questions on StackOverflow, and I think I found a bug that causes a crash during JSON deserialization, when the results include a question that was migrated to a different site. Is this a known bug?
This is the exception:
Newtonsoft.Json.JsonSerializationException was unhandled.
Message=Error converting value "main_site" to type >'System.Nullable`1[BridgeStack.SiteTypeEnum]'.
In Json.cs, line 44
(I can get a full stack-trace, if you want).
I define my QuestionQuery like this:
stackClient.Default.Site = NetworkSiteEnum.StackOverflow;
var query = new QuestionsQuery
{
PageSize = 30,
Sort = QuerySortEnum.Creation,
Order = QueryOrderEnum.Descending
};
and the returned JSON includes this question:
(Note the "main_site" under "other_site" under "migrated to".
Ok, I narrowed it down, cut down the to the exact bit that's crashing. This is the enum from BridgeStack:
public enum SiteTypeEnum
{
[EnumMember(Value = "main_site")] Main,
[EnumMember(Value = "meta_site")] Meta
}
And this is the JSON that's being deserialized:
var json = "\"site_type\":\"main_site\"";
var q = JsonConvert.DeserializeObject<SiteTypeEnum?>(json);
Same exception as before:
Newtonsoft.Json.JsonSerializationException: Error converting value "site_type" to type 'System.Nullable1[BridgeStack.SiteTypeEnum]'. ---> System.Exception: Could not cast or convert from System.String to System.Nullable1[BridgeStack.SiteTypeEnum].
Hey there.
I'm using BridgeStack to write a script that goes over questions on StackOverflow, and I think I found a bug that causes a crash during JSON deserialization, when the results include a question that was migrated to a different site. Is this a known bug?
This is the exception:
(I can get a full stack-trace, if you want).
I define my QuestionQuery like this:
and the returned JSON includes this question:
(Note the "main_site" under "other_site" under "migrated to".
The text was updated successfully, but these errors were encountered: