title: Cannot add a role assignment with empty role definition binding collection
body: <p>I am trying to give a permission to user using ClientContext in SharePoint 2013. I have done all exactly the same as in the Microsoft web site <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.roledefinitionbindingcollection.add.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.roledefinitionbindingcollection.add.aspx</a></p>
  
  <p>But at the end, this part of code always returns exception "Cannot add a role assignment with empty role definition binding collection":</p>
  
  <pre><code>RoleAssignment oRoleAssignment = w.RoleAssignments.Add(oUser, roleDefBinding);                            
  clientContext.ExecuteQuery();
  </code></pre>
  
  <p>I haves searched web, found similar problems to some other users but without responses.
  Any ideas?</p>
  
  <p>My Code:</p>
  
  <pre><code>clientContext.Load(w.RoleDefinitions);
  clientContext.ExecuteQuery();
  var role = w.RoleDefinitions.Where(r =&gt; r.Name == roleName);
  if (role.Count() &gt; 0)
  {
         RoleDefinition roleMSP = role.First();
         clientContext.Load(w.SiteUsers);
         clientContext.ExecuteQuery();
         var user = w.SiteUsers.Where(u=&gt; u.LoginName == "c:0+.w|s-1-5-21-3493872076-3631449775-1555872641-1347");
         if (user.Count() &gt; 0)
         {
               // Create a new RoleDefinitionBindingCollection object.
               RoleDefinitionBindingCollection roleDefBinding = new RoleDefinitionBindingCollection(clientContext);
               roleDefBinding.Add(roleMSP);
               User oUser = user.First() as User;
  
               clientContext.Load(w.RoleAssignments);
               clientContext.ExecuteQuery();
  
               RoleAssignment oRoleAssignment = w.RoleAssignments.Add(oUser, roleDefBinding);                            
               clientContext.ExecuteQuery();//Here I get an exception
          }
  }
  </code></pre>