I started getting this error when calling ReadIdentities... After updating from Visual studio 2010 to 2012 SDK. It crashes due to invalid "\t" in one of the members. (New validation rules in TFS API probably).
var GSS = tfs.GetService<IIdentityManagementService>();
Identity SIDS = project.GSS.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Members", QueryMembership.Expanded);
var _TFSUsers = project.GSS.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);
The saddest part of this story is that I need to find out which member has this tab char. And TFS contains 2000+ members. I tried running one by one, but only ReadIdentities method crashes. ReadIdentity passes. So decided to follow these steps:
foreach (var memberSID in SIDS.Members)
{
try
{
var identity = project.GSS.ReadIdentities(SearchFactor.Sid,new string[] { memberSID,}, QueryMembership.None);
}
catch (Exception ex2)
{
throw new InvalidOperationException("Failed to load TFS user: " + memberSID, ex2);
}
}
Yet somehow this did not work either! As the code ran flawlessly with no exceptions.