title: Xamarin.Forms - TypeLoadException Failure has occurred while loading a type
body: <p>I am using portable Xamarin forms - CrossPlatform.
  In xamarin form there are two projects Android and IOS</p>
  
  <p>Below code is working perfectly when I run in android APP.
  But same code is not working in IOS.</p>
  
  <p>It is giving error "Failure has occurred while loading a type" on line "var response = await client.Execute(request);"</p>
  
  <p>Below is my code</p>
  
  <pre class="lang-cs prettyprint-override"><code>public async Task&lt;ResponseGeneralObject&lt;TokenModel&gt;&gt; LoginUser(LoginModel loginModel)
  {
      ResponseGeneralObject&lt;TokenModel&gt; result = new ResponseGeneralObject&lt;TokenModel&gt;();
      try
      {
          var restUrl = App.URLServicePath + "token";
          var client = new RestClient(restUrl);
          TokenModel model = new TokenModel();
  
          var request = new RestRequest("", Method.POST);
          request.AddParameter("grant_type", "password");
          request.AddParameter("username", loginModel.UserName);
          request.AddParameter("password", loginModel.Password);
  
          var response = await client.Execute(request);
          var content = response.Content;
  
          if (response.StatusCode == System.Net.HttpStatusCode.OK)
          {
              result.data = JsonConvert.DeserializeObject&lt;TokenModel&gt;(content);
              // model = new JavaScriptSerializer().Deserialize&lt;TokenModel&gt;(response.Result.Content);
              result.iserror = false;
          }
          else
          {
              result.iserror = true;
              result.message = "Internal error!";
          }
      }
      catch (Exception ex)
      {
          result.iserror = true;
          result.message = ex.Message;
      }
      return result;
  }
  </code></pre>