Skip to content

Duplicate Authenticated event in ImapClient #784

Description

@SylwesterZarebski

Describe the bug
After updating to newest 2.1.0.3 NuGet package i observe two Authenticated events instead of one.
Previous version was 2.0.4.

To Reproduce
I hope this code excerpt will help (original code has additional logging and multiple cancellation token checks):

imapClient = new ImapClient();
imapClient.Connected += onClientConnected;
imapClient.Authenticated += onClientAuthenticated;
imapClient.Disconnected += onClientDisconnected;
imapClient.Connect(uri, ct);
...
private void onClientConnected(object sender, EventArgs e)
{
    logger.Info("Connected with: " + uri);
    imapClient.AuthenticationMechanisms.Remove("XOAUTH2");
    imapClient.Authenticate(credentials, ct);
}
private void onClientAuthenticated(object sender, AuthenticatedEventArgs e)
{
    logger.Debug("Authenticated to: " + uri);
    // Some after auth code
}

Expected behavior
My onClientAuthenticated method should be called once, but is twice.

Screenshots
NET Framework 4.6, Windows 2008 R2
From my application log:

[2018-12-10 16:08:22.4837] Info EmailWatcherElement.onClientConnected: Connected with: ...
[2018-12-10 16:08:22.9710] Debug EmailWatcherElement.onClientAuthenticated: Authenticated to: ...
[2018-12-10 16:08:23.0003] Debug EmailWatcherElement.onClientAuthenticated: Detected trash: Trash
[2018-12-10 16:08:23.0169] Debug EmailWatcherElement.onClientAuthenticated: Authenticated to: ...
[2018-12-10 16:08:23.0169] Debug EmailWatcherElement.onClientAuthenticated: Detected trash: Trash

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions