Exception when updating LoginCredential.Username after upgrade from 4.8 to 6.2.2

Hi!

After upgrade from 4.8 to 6.2.2 I cannot not update login credentials for existing users.

The following code:

var person = customerPerson.MakeWritableClone();
person.LoginCredential.Username = string.IsNullOrEmpty(customerPerson.Email) ? customerPerson.Id : customerPerson.Email;
person.LoginCredential.NewPassword = customerPerson.Id;
_personService.Update(person);

gives me:

Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.

vid Litium.Application.Data.LitiumDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
vid Litium.Application.Data.Batching.BatchDataImpl.Commit()
vid Litium.Application.Customers.PersonServiceImpl.Update(Person person)
vid Litium.Studio.Integration.Implementation.Imports.CustomerImportLogic.SetupCustomerUserAccount(Person customerPerson, Boolean shouldActivate, Boolean isNew) i D:\Projekt\Fresks\Development\Web\Src\Litium.Studio.Integration.Implementation\Imports\CustomerImportLogic.cs:rad 209
vid Litium.Studio.Integration.Implementation.Imports.CustomerImportLogic.UpdateCustomer(Item item, Person customerPerson) i D:\Projekt\Fresks\Development\Web\Src\Litium.Studio.Integration.Implementation\Imports\CustomerImportLogic.cs:rad 198
vid Litium.Studio.Integration.Implementation.Imports.CustomerImportLogic.CreateOrUpdateCustomer(Item item) i D:\Projekt\Fresks\Development\Web\Src\Litium.Studio.Integration.Implementation\Imports\CustomerImportLogic.cs:rad 164
vid Litium.Studio.Integration.Implementation.Imports.CustomerImportLogic.ProcessItem(Item item) i D:\Projekt\Fresks\Development\Web\Src\Litium.Studio.Integration.Implementation\Imports\CustomerImportLogic.cs:rad 113

If I try to update login credentials from Litium backoffice I get “An error has occured”.
I guess it is the same error as when I try to update from code.

Thanks!

/Kristoffer

Litium version: 6.2.2.

Your coworker have a support ticket for the same case where we reply that the database upgrade need to be executed again on a database from the database backup because you have bad data in the Foundation_User table was throwing exception when you run the database script.

Before you rerun the database script on the restored database you need to remove the following row in the database that will cause the upgrade script exception.

Userid                                  Login       PwdDte  Password
3C1C8503-7212-43A8-8803-AE725F7BAB2F	Authority	NULL	!Authority: