Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP -> Authenticate: NullReferenceException #851

Closed
Miraichi opened this issue Apr 27, 2019 · 3 comments
Closed

IMAP -> Authenticate: NullReferenceException #851

Miraichi opened this issue Apr 27, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@Miraichi
Copy link

Get Exception when authenticating into imap server:

   в MailKit.Net.Imap.ImapCommand.<StepAsync>d__82.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в MailKit.Net.Imap.ImapEngine.<IterateAsync>d__170.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в MailKit.Net.Imap.ImapEngine.<RunAsync>d__171.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   в MailKit.Net.Imap.ImapClient.<AuthenticateAsync>d__84.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в MailKit.Net.Imap.ImapClient.Authenticate(Encoding encoding, ICredentials credentials, CancellationToken cancellationToken)
   в MailKit.MailService.Authenticate(Encoding encoding, String userName, String password, CancellationToken cancellationToken)
   в MailKit.MailService.Authenticate(String userName, String password, CancellationToken cancellationToken)

Its my simple code:

imapClient.Connect(IMAPServer.Hostname, IMAPServer.Port, true);
if (imapClient.IsConnected)
{
          imapClient.Authenticate(login, password);
          if (imapClient.IsAuthenticated)
          {
                 return true;
           }
}
return false;
@jstedfast
Copy link
Owner

Can you get me a protocol log? Trying to diagnose this problem using that async backtrace is impossible and I can't replicate the issue. Check the FAQ to see ho to get this protocol log.

@jstedfast jstedfast added the bug Something isn't working label Apr 27, 2019
@Miraichi
Copy link
Author

Miraichi commented Apr 28, 2019

Protocol log:

Connected to imap://in.alice.it:143/?starttls=when-available
S: * OK IMAP4 PROXY server ready
C: A00000000 CAPABILITY
S: * CAPABILITY IMAP4rev1 UIDPLUS LOGIN-REFERRALS NAMESPACE QUOTA CHILDREN AUTH=CRAM-MD5 AUTH=PLAIN
S: A00000000 OK capabilities listed
C: A00000001 AUTHENTICATE CRAM-MD5
S: + PDFCRDI5QzdEQTNDNDU5QjcwMzYxQkFFODM2N0QwQzIxMTRCQzVFOTFAbHAzMXQtYWxpY2UuY3AuYWxpY2UuaXQ+
C: XXX
S: * BYE disconnecting
S: A00000001 NO you are not allowed to act as a proxy server

Upd:
Its because i set proxy? Without proxy i don't get Exception.

Connected to imap://in.alice.it:143/?starttls=when-available
S: * OK IMAP4 PROXY server ready
C: A00000000 CAPABILITY
S: * CAPABILITY IMAP4rev1 UIDPLUS LOGIN-REFERRALS NAMESPACE QUOTA CHILDREN AUTH=CRAM-MD5 AUTH=PLAIN
S: A00000000 OK capabilities listed
C: A00000001 AUTHENTICATE CRAM-MD5
S: + PEMxNTQwQTk1QTM4N0I3NURDN0I5NkIwNDhGMUNBNkMwMkNEODE5MDhAbG9naW5wcm94eTRiLWFsaWNlLmNwLmFsaWNlLml0Pg==
C: XXX
S: A00000001 OK authentication successful

@jstedfast
Copy link
Owner

Thanks for the info, I've got a fix for the NullReferenceException now. I'm not sure what can be done about the proxy error from the server...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants