behavior when accessing deleted mail

Nov 5, 2013 at 7:49 AM
Hi,
I'm actually testing the behavior of cuncurrent accessing mails in one mailbox. When downloading messages in a loop, there is a NullReferenceException thrown in case of one message is deleted in the meanwhile. Would be nice if this case is handled explicitly. For example return false in message.Download(), or message gets something like a state property saying "deleted".
foreach (var message in _client.Folders.Inbox.Messages)
{
    bool downloadOk = message.Download(ImapX.Enums.MessageFetchMode.Full);
}
NullReferenceException. Object reference is not set to an instance of an object
MessageContent.cs
ln 210 if(ContentStream.EndsWith(")"))

ImapX.dll!ImapX.MessageContent.ProcessCommandResult(string data) Line 210
ImapX.dll!ImapX.ImapBase.SendAndReceive(string command, ref System.Collections.Generic.IList<string> data, ImapX.Parsing.CommandProcessor processor, System.Text.Encoding encoding) Line 351 + 0x1f bytes
ImapX.dll!ImapX.MessageContent.Download() Line 237 + 0xe0 bytes
ImapX.dll!ImapX.Message.Download(ImapX.Enums.MessageFetchMode mode, bool reloadHeaders) Line 533 + 0x12 bytes

Ciao
Thorsten
Coordinator
Nov 5, 2013 at 8:01 AM
Hi Thorsten,

there's an update coming which will improve thread-safety of the library, and I will also consider the issue you mentioned! Thank you!

Greets,

Pavel