bevacqua/BridgeStack — Issue #1: Error on JSON deserialiation on migrated questions.
Author: lisardggY
Created: 2012-02-26 11:03:41+00:00
State: open

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:

> 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".

> {"question_id":9450616,"last_edit_date":1330232950,"creation_date":1330231596,"last_activity_date":1330233221,"locked_date":1330237275,"score":0,"answer_count":0,"migrated_to":{"question_id":394120,"other_site":{"site_type":"main_site","name":"Super User","logo_url":"http://sstatic.net/superuser/img/logo.png","api_site_parameter":"superuser","site_url":"http://superuser.com","audience":"computer enthusiasts and power users","icon_url":"http://sstatic.net/superuser/img/apple-touch-icon.png","site_state":"normal","styling":{"link_color":"#1086A4","tag_foreground_color":"#1087A4","tag_background_color":"#FFFFFF"},"launch_date":1250553600,"favicon_url":"http://sstatic.net/superuser/img/favicon.ico","related_sites":[{"name":"Meta Super User","site_url":"http://meta.superuser.com","relation":"meta","api_site_parameter":"meta.superuser"},{"name":"Chat Stack Exchange","site_url":"http://chat.stackexchange.com","relation":"chat"}],"twitter_account":"StackSuper_User"},"on_date":1330237275},"closed_date":1330237274,"title":"Linux Ram Limits","tags":["linux","bash"],"closed_reason":"off topic","view_count":36,"owner":{"user_id":1233384,"display_name":"Trey G.","reputation":1,"user_type":"registered","profile_image":"http://www.gravatar.com/avatar/45777bf1824d3854753c6e30cce6f405?d=identicon&r=PG","link":"http://stackover flow.com/users/1233384/trey-g"},"link":"http://stackoverflow.com/questions/9450616/linux-ram-limits","is_answered":false}