IRestResponse Error in Program.Core

2 replies. Last post: August 12, 2014 5:35 AM by Yudi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Ryan HermanMember

I'm having an issue where I cannot await the client.ExecuteAsync.  The code works if I place it in .IOS or .Android but not in .Core.  The error is issued on "IRestResponse response = await client.ExecuteAsync (request);"

Cannot await System.Tasks.Task<Intersoft.Crosslight.RestClient.IRestResponse>' Expression

		async private void SignUpUser(object parameter)
		{
			//this.MessagePresenter.Show ("Signup " + firstNameEntry + " " + lastNameEntry);
			string baseUrl = "http://localhost:3000/api";

			ComplexData data = new ComplexData();
			data.UserInfo = new UserInfo { FirstName = _firstName, LastName = _lastName, Email = _email };

			// create the RestClient
			IRestClient client = new RestClient(baseUrl);

			// create RestRequest to access GET api/values
			IRestRequest request = new RestRequest("", HttpMethod.POST); 
			request.RequestFormat = RequestDataFormat.Json;

			request.AddBody (data);

			// execute the RestRequest
			IRestResponse response =  await client.ExecuteAsync (request);


			this.MessagePresenter.Show ("Response: " + response.Content);

		}

 

1 attachment
All times are GMT -5. The time now is 12:37 AM.
Previous Next