NullReferenceException in MemberController.PostSave() when calling Roles.GetRolesForUser()
I have recently upgraded a site from v6.1.6 to v7.10.4 (in multiple steps) and everything is fine with the exception of the Membership functionality.
The site has several member types and member groups already has 100+ members. However, now I cannot create a new member. When I do I get a NullReferenceException in the logs:
2018-05-15 11:23:08,894 [P6340/D9/T8] ERROR Umbraco.Web.Editors.MemberController - Unhandled controller exception occurred
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Web.Security.Roles.GetRolesForUser(String username)
at Umbraco.Web.Editors.MemberController.PostSave(MemberSave contentItem)
Looking at the MemberController code in the CMS source, I can see that GetRolesForUser() on line 302 is expecting a non-null contentItem.PersistedContent.Username property but this is null:
var currRoles = Roles.GetRolesForUser(contentItem.PersistedContent.Username);
I know that it is the Username property that is null since on a previous line MapPropertyValues() is called which references contentItem.PersistedContent and if this property was null, the exception would be thrown here and be shown in the stack trace.
That is a good question, i would do a schema check with a sql compare or somesuch.. so you can see all the tables that have changed and look at the specific ones which may be regarding user/member
NullReferenceException in MemberController.PostSave() when calling Roles.GetRolesForUser()
I have recently upgraded a site from v6.1.6 to v7.10.4 (in multiple steps) and everything is fine with the exception of the Membership functionality.
The site has several member types and member groups already has 100+ members. However, now I cannot create a new member. When I do I get a
NullReferenceException
in the logs:Looking at the
MemberController
code in the CMS source, I can see thatGetRolesForUser()
on line 302 is expecting a non-nullcontentItem.PersistedContent.Username
property but this is null:I know that it is the
Username
property that is null since on a previous lineMapPropertyValues()
is called which referencescontentItem.PersistedContent
and if this property was null, the exception would be thrown here and be shown in the stack trace.Can anyone think why this would be the case?
Thanks.
look t the tables and see if the column that should be auto incremented and creating id .. i suspect you've lost that in the scripting
Thanks for the suggestion Ravi. Which table are you suggesting should be autoincrementing? I can't see anything that should be.
That is a good question, i would do a schema check with a sql compare or somesuch.. so you can see all the tables that have changed and look at the specific ones which may be regarding user/member
is working on a reply...