Error: A valid UTF32 value is between 0x000000 and 0x10ffff when getting result
I am getting an error when I hit a specific post in Facebook:
Here is the code to run: Just replace to token with yours...
FacebookClient client = new FacebookClient(yourTokenHere);
var result = client.Batch(
new FacebookBatchParameter(HttpMethod.Get, "/198907640664_196037430420783"),
new FacebookBatchParameter(HttpMethod.Get, "/198907640664_196037430420783/comments", new Dictionary<string, object> { { "limit", 20 } }) { Data = new { name = "myposts", omit_response_on_success = false } }
);
The error received is:
Error: A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff). Parameter name: utf32
The stack trace is:
System.ArgumentOutOfRangeException: A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff). Parameter name: utf32 at System.Char.ConvertFromUtf32(Int32 utf32) at SimpleJson.SimpleJson.ParseString(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseValue(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseObject(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseValue(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseArray(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseValue(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseObject(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseValue(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseObject(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseValue(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseArray(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseValue(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseObject(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.ParseValue(Char[] json, Int32& index, Boolean& success) at SimpleJson.SimpleJson.TryDeserializeObject(String json, Object& object) at SimpleJson.SimpleJson.DeserializeObject(String jso开发者_JAVA百科n) at Facebook.JsonSerializer.SimpleJsonSerializer.DeserializeObject(String json) at Facebook.FacebookClient.ProcessBatchResult(Object result) at Facebook.FacebookClient.Batch(FacebookBatchParameter[] batchParameters)
I do get this error with other calls as well.
Thanks in advance for any help.
Just found out that Prabir (The Man of the Facebook C# SDK) have released a new version of SimpleJson v0.7 containing this bug fix. http://simplejson.codeplex.com/releases/view/69446
and also updated the SimpleJson in Facebook C# SDK to v0.7 http://facebooksdk.codeplex.com/SourceControl/changeset/changes/4f05d3ba8c17
I have tried it and it works fine!
Thanks Prabir
精彩评论