Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ирина Кайзер 3 posts 73 karma points
    Aug 29, 2022 @ 09:49
    Ирина Кайзер
    0

    CreateMemberWithIdentity doesn't work in V10.1.0

    Hi,

    After update umbraco from 10.0.1 to 10.1.0 I've got exception when use CreateMemberWithIdentity method.

    var newMember = MemberService.CreateMemberWithIdentity(email, email, FullName, "SiteMember");
    

    email and FullName are not empty.

    ArgumentException: Cannot save member with empty name. Umbraco.Cms.Core.Services.MemberService.Save(IMember member).

    Irina

  • Dat Nguyen 2 posts 73 karma points
    Oct 09, 2022 @ 09:36
    Dat Nguyen
    1

    I have the same problem too. Using VS 2022's decompiler, I was able to look at the code for CreateMemberWithIdentity and saw what seems to be an obvious bug:

    enter image description here

    These methods are within the MemberService class. Since I'm using dependency injection, I was calling the methods exposed by the IMemberService interface. The first method can be called in my code, but the other two overloaded methods shown here, though they are public, are not exposed via the interface and thus, can't be called in my code.

    The first method calls one of the overloaded methods below but passes string.Empty instead of the value of the "name" parameter. That is the cause of the issue.

    To get around this, I instantiated the MemberService class (I needed to provide all the necessary services for the constructor) and called the overloaded method that works properly. It's not ideal, but it'll have to do until Umbraco fixes that bug. If someone else has a better solution, please post it.

Please Sign in or register to post replies

Write your reply to:

Draft