I have a strange issue where when I call EnsureUser I get an error that the SharePoint user is not unique or cannot be found.
I have set up claims auth in 2010 using SQL membership provider. Got all the correct membership and profile entries in main site, CA and Security token web.configs.
I have the membership accounts created such that the email address is used for the username field as well as the email field.
The crazy thing is that for certain email addresses EnsureUser works fine but for others I get the error. I just can't work out why that would be.
Even if the code errors I am able to use the UI and manually add the FBA user using people picker with no error just fine.
The code which attempts to run EnsureUser is running in an elevated priv with correctly instantiated new SPSite and SPWeb objects and AllowUnSafeupdates set to true.