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

MailKit.Net.Imap.ImapFolder.Open throws exception 'Unable to cast object of type 'System.Char' to type 'System.String'.' #522

Closed
michaelthomson opened this issue Jun 13, 2017 · 1 comment
Labels
bug Something isn't working

Comments

@michaelthomson
Copy link

michaelthomson commented Jun 13, 2017

We use MailKit to poll various email servers operated by our customers. The code we have works for most of our customers, however for one of our customer we're getting this exception on ImapFolder.Open().

Exception message:

System.InvalidCastException: 'Unable to cast object of type 'System.Char' to type 'System.String'.'

Stack trace:

at MailKit.Net.Imap.ImapEngine.ProcessUntaggedResponse(CancellationToken cancellationToken)
at MailKit.Net.Imap.ImapCommand.Step()
at MailKit.Net.Imap.ImapEngine.Iterate()
at MailKit.Net.Imap.ImapEngine.Wait(ImapCommand ic)
at MailKit.Net.Imap.ImapFolder.Open(FolderAccess access, CancellationToken cancellationToken)

Code:

private IList<UniqueId> GetMessageIds(IMailFolder folder)
{
	folder.Open(FolderAccess.ReadWrite);
	folder.Check();
	return folder.Search(SearchQuery.DoesNotHaveFlags(MessageFlags.Flagged));
}

Protocol log:

Connected to imaps://imap.[[REDACTED]].com:993/
S: * OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID AUTH=PLAIN AUTH=LOGIN SASL-IR] .[[REDACTED]].com Cyrus IMAP4 v2.3.7-Invoca-RPM-2.3.7-16.el5_11 server ready
C: B00000000 AUTHENTICATE PLAIN [[REDACTED]]
S: B00000000 OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID LOGINDISABLED ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT SORT=MODSEQ THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE CATENATE CONDSTORE IDLE LISTEXT LIST-SUBSCRIBED X-NETSCAPE URLAUTH] Success (tls protection)
C: B00000001 NAMESPACE
S: * NAMESPACE (("INBOX/" "/")) (("user/" "/")) (("" "/"))
S: B00000001 OK Completed
C: B00000002 LIST "" "INBOX"
S: * LIST (\HasChildren) "/" "INBOX"
S: B00000002 OK Completed (0.000 secs 5 calls)
C: B00000003 SELECT INBOX (CONDSTORE)
S: * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
S: * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen *)]
S: * OK (seen state failure) Unable to preserve \Seen state: System I/O error
S: * 67 EXISTS
S: * 67 RECENT
S: * OK [UNSEEN 1]
S: * OK [UIDVALIDITY 1316426398]
S: * OK [UIDNEXT 68]
S: * OK [NOMODSEQ] Sorry, modsequences have not been enabled on this mailbox
S: B00000003 OK [READ-WRITE] Completed

davidthompsonct added a commit to CloudTrade/MailKit that referenced this issue Jun 13, 2017
jstedfast added a commit that referenced this issue Jun 13, 2017
@jstedfast jstedfast added the bug Something isn't working label Jun 13, 2017
@jstedfast
Copy link
Owner

Thanks!

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