Xamarin.android 单机器人&;RestSharp,methodmissingeexception

Xamarin.android 单机器人&;RestSharp,methodmissingeexception,xamarin.android,restsharp,Xamarin.android,Restsharp,我正试图将RestSharp用于MonoDroid,但遇到了一些问题。抛出MethodMissingException,消息为“未找到EmPublate.Android.Tweet[]类型的默认构造函数”。我只能在VS调试器中检查任务时看到异常,它不会显示在LogCat中。我知道异常与RestSharp中的JSON反序列化有关 链接器在MonoDroid选项中设置为“无”,我还尝试将[Preserve]属性添加到我的DTO中 除了让它工作之外,为什么它不会崩溃并出现在LogCat中?我希望在访问

我正试图将RestSharp用于MonoDroid,但遇到了一些问题。抛出MethodMissingException,消息为“未找到EmPublate.Android.Tweet[]类型的默认构造函数”。我只能在VS调试器中检查任务时看到异常,它不会显示在LogCat中。我知道异常与RestSharp中的JSON反序列化有关

链接器在MonoDroid选项中设置为“无”,我还尝试将[Preserve]属性添加到我的DTO中

除了让它工作之外,为什么它不会崩溃并出现在LogCat中?我希望在访问结果时,任何出现异常的任务都能重新显示异常

[活动(Label=“EmPubLite”,MainLauncher=true,Icon=“@drawable/Icon”)]
公共类EmPubLiteActivity:活动
{
创建时受保护的覆盖无效(捆绑包)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.EmPubLight);
var client=new TwitterClient();
client.Search(“bielema”).ContinueWith(tweets=>
{
Debug.WriteLine(“返回”);
Debug.WriteLine(tweets.Result[0].Text);//LogCat中未显示异常
});
}
}
公共类twitter客户端
{
private RestClient=new RestClient();
公共任务搜索(字符串查询)
{
var请求=新的重新请求(“http://search.twitter.com/search.json?rpp=5&include_entities=true&result_type=mixed&q={q} “,Method.GET);
request.AddUrlSegment(“q”,查询);
var taskCompletionSource=新的taskCompletionSource();
client.ExecuteAsync(请求、响应=>
{
if(response.ErrorException!=null)taskCompletionSource.TrySetException(response.ErrorException);
else taskCompletionSource.TrySetResult(response.Data.Results);
//taskCompletionSource.TrySetResult(response.Data.Results);
});
返回taskCompletionSource.Task;
}
}
公共类搜索结果
{
公共Tweet[]结果{get;set;}
}
公共类推文
{
公共字符串文本{get;set;}
}

我通过使用ServiceStack JSON解析器而不是默认的RestSharp JSON解析器解决了这个问题。

我通过使用ServiceStack JSON解析器而不是默认的RestSharp JSON解析器解决了这个问题