UserPrincipal.FindByIdentity results in a supressed exception RRS feed

  • Question

  • I am using

    private bool AccountEnabled(string userName)



    var user = UserPrincipal.FindByIdentity(_domainContext, userName);


    if (user.Enabled.Value) return true;


    return false;


    The method call UserPrincipal.FindByIdentity(_domainContext, userName);

    results in

    A first chance exception of type 'System.FormatException' occurred in mscorlib.dll

    each time it is called.

    It appears to working OK however.

    I am not sure why this is happening.

    I am getting the domainContext via

    _domainContext =

    new PrincipalContext(ContextType.Domain);

    The userName is structured as "domain\\userAccount"

    Is this a cause for concern?

    Can this be fixed if it is?

    Wednesday, November 3, 2010 3:27 AM