我怎样才能找到为什么RestSharp PUT抛出异常?

时间:2016-08-19 10:30:29

标签: c# uwp restsharp

我已发送了PUT个请求并在NullReferenceException中获得了RestSharp.Portable

using (var client = new RestClient(new Uri(BaseUri)))
{
    var oAuth1Authenticator = OAuth1Authenticator.ForAccessToken(
      OAuthConsumerKey,
      OAuthConsumerSecret,
      oAuthToken", 
      oAuthSecret"
    );

    client.Authenticator = oAuth1Authenticator;

    var request = new RestRequest(lastPartUri, httpMethod);

    request.AddJsonBody(body);

    IRestResponse response = await client.Execute(request);

    return response.Content;
}

IRestResponse response = await client.Execute(request);抛出异常。

OAuth参数绝对不是nullBaseUrilastPartUri也不是bodyDictionary<string, string>POST,也不是空。

具有相同参数的

GETRestSharp请求可以正常工作。

问题出现在 at RestSharp.Portable.Authenticators.OAuth1Authenticator.<>c.<AddOAuthData>b__84_3(Parameter p) at System.Linq.Enumerable.WhereListIterator`1.MoveNext() at RestSharp.Portable.Authenticators.OAuth1Authenticator.AddOAuthData(IRestClient client, IRestRequest request, OAuthWorkflow workflow) at RestSharp.Portable.Authenticators.OAuth1Authenticator.PreAuthenticate(IRestClient client, IRestRequest request, ICredentials credentials) at RestSharp.Portable.RestClientBase.<ExecuteRequest>d__67.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RestSharp.Portable.HttpClient.RestClient.<Execute>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Store.Helpers.MyBookApiConnector.<SendRequest>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Store.Services.DataService.<UpdateReview>d__80.MoveNext() 库中。我怎么能找到它?

这是堆栈跟踪:

styleClass

Before exception After exception

1 个答案:

答案 0 :(得分:2)

这确实是图书馆中的一个错误。开发人员已经修好了。