Bug #76088 Cannot create user if profile table is customized
Submitted: 2 Mar 2015 6:59 Modified: 2 Apr 2015 11:29
Reporter: Song Kevin Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.9.5.0 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: simplemembershipprovider

[2 Mar 2015 6:59] Song Kevin
Description:
SimpleMembershipProvider.cs

CreateUserInUserTable method. MySql.Data recognized argsValues.ToArray() as a single parameter instead of items in side the array.

using (MySqlDatabaseWrapper dbConn = new MySqlDatabaseWrapper(GetConnectionString()))
      {
        if (dbConn.ExecuteNonQuery(string.Format("insert into {0} ({1}) values({2})", UserTableName, columns.ToString(), args.ToString()), userName, argsValues.ToArray()) < 1)
        {
          throw new MembershipCreateUserException(MembershipCreateStatus.ProviderError);
        }
      }

How to repeat:
Add additional columns to userprofile table. For following sample, I added Email, FirstName and LastName.

Try to call SimpleMembership API with additional user profile information as below.

MySqlWebSecurity.CreateUserAndAccount(user.UserName, user.UserName,
                        new { Email = user.Email, FirstName = user.FirstName, LastName = user.LastName });

Suggested fix:
using (MySqlDatabaseWrapper dbConn = new MySqlDatabaseWrapper(GetConnectionString()))
      {
          var insertQuery = string.Format("insert into {0} ({1}) values({2})", UserTableName, columns, args);
          var paramArray = new List<object> { userName };
          paramArray.AddRange(argsValues);
          if (dbConn.ExecuteNonQuery(insertQuery, paramArray.ToArray()) < 1)
            {
              throw new MembershipCreateUserException(MembershipCreateStatus.ProviderError);
            }
      }
[2 Mar 2015 11:29] Chiranjeevi Battula
Hello Song Kevin,

Thank you for the bug report.
I tried to reproduce the issue at my end using Visual Studio 2013, MySQL Connector/Net 6.9.5, but couldn't trace out any issue in modifying user profile.
Could you please list out the steps you tried out at your end? Please provide repeatable test case in order for us to confirm this issue at our end.

Thanks,
Chiranjeevi.
[2 Mar 2015 11:29] Chiranjeevi Battula
Screenshot

Attachment: 76088.png (image/png, text), 20.64 KiB.

[3 Apr 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".