IMAP System.ArgumentOutOfRangeException

Hello!

I’m trying to reach the emclient staff as a personal user of the free version 8.0.2951 (e2fe9f0). I was thinking about buying the license to get pro support, but I don’t like the idea of paying for a software with a known bug in the modules I need. The exception only occurs while syncing this subfolder. Other subfolders in the same folder work. Here is the complete exception message:

18.08.2020 12:03:24 xxx@xxx.xxx IMAP Synchronizing folder ‘/Handel.eBay’
18.08.2020 12:03:24 System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)
18.08.2020 12:03:24 at System.Collections.Generic.List`1.get_Item(Int32 index)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.BodyStructure…ctor(IReadOnlyList`1 list, Boolean zeroSizeHack, BodyStructure parentPart)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.BodyStructure…ctor(IReadOnlyList`1 list, Boolean zeroSizeHack)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.ImapMail…ctor(IReadOnlyDictionary`2 parts, Boolean zeroSizeHack)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.<>c__DisplayClass100_0.g__ProcessFetchNotifications
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.<>c__DisplayClass100_0.g__ProcessPriorityUpdatesAsync
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.<>c__DisplayClass100_0.<g__FetchNewMessagesAsync
18.08.2020 12:03:24 — End of stack trace from previous location where exception was thrown —
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.SynchronizeMessagesAsync(IItemSynchronizeContext`1 synchronizeContext, Folder folder, Boolean fast, CancellationToken cancellationToken)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.SynchronizeMessagesAsync(IItemSynchronizeContext`1 synchronizeContext, Folder folder, Boolean fast, CancellationToken cancellationToken)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.Synchronize(IItemSynchronizeContext`1 synchronizeContext, Folder folder, CancellationToken cancellationToken)
18.08.2020 12:03:24 at MailClient.Protocols.Common.ItemSynchronizer`2.<>c__DisplayClass37_1.b__6(WorkerStatus status, CancellationToken ct)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapActionCommand.<>c__DisplayClass12_0.<.ctor>b__0(WorkerStatus ws, CancellationToken ct)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapActionCommand.ExecuteInternalSync(WorkerStatus status)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapActionCommand.Execute(WorkerStatus status)
18.08.2020 12:03:24 at MailClient.Commands.Command.Process(WorkerStatus status)
18.08.2020 12:03:24 — End of stack trace from previous location where exception was thrown —
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapAccount.SynchronizeIntAsync(Boolean forced)
18.08.2020 12:03:24 at MailClient.Protocols.Common.SynchronizableMailAccount.<>c__DisplayClass6_0.<b__0>d.MoveNext()
18.08.2020 12:03:24 System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter ‘index’)
18.08.2020 12:03:24 at System.Collections.Generic.List`1.get_Item(Int32 index)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.BodyStructure…ctor(IReadOnlyList`1 list, Boolean zeroSizeHack, BodyStructure parentPart)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.BodyStructure…ctor(IReadOnlyList`1 list, Boolean zeroSizeHack)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.ImapMail…ctor(IReadOnlyDictionary`2 parts, Boolean zeroSizeHack)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.<>c__DisplayClass100_0.g__ProcessFetchNotifications
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.<>c__DisplayClass100_0.g__ProcessPriorityUpdatesAsync
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.<>c__DisplayClass100_0.<g__FetchNewMessagesAsync
18.08.2020 12:03:24 — End of stack trace from previous location where exception was thrown —
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.SynchronizeMessagesAsync(IItemSynchronizeContext`1 synchronizeContext, Folder folder, Boolean fast, CancellationToken cancellationToken)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.SynchronizeMessagesAsync(IItemSynchronizeContext`1 synchronizeContext, Folder folder, Boolean fast, CancellationToken cancellationToken)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapMailSynchronizer.Synchronize(IItemSynchronizeContext`1 synchronizeContext, Folder folder, CancellationToken cancellationToken)
18.08.2020 12:03:24 at MailClient.Protocols.Common.ItemSynchronizer`2.<>c__DisplayClass37_1.b__6(WorkerStatus status, CancellationToken ct)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapActionCommand.<>c__DisplayClass12_0.<.ctor>b__0(WorkerStatus ws, CancellationToken ct)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapActionCommand.ExecuteInternalSync(WorkerStatus status)
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapActionCommand.Execute(WorkerStatus status)
18.08.2020 12:03:24 at MailClient.Commands.Command.Process(WorkerStatus status)
18.08.2020 12:03:24 — End of stack trace from previous location where exception was thrown —
18.08.2020 12:03:24 at MailClient.Protocols.Imap.ImapAccount.SynchronizeIntAsync(Boolean forced)
18.08.2020 12:03:24 at MailClient.Protocols.Common.SynchronizableMailAccount.<>c__DisplayClass6_0.<b__0>d.MoveNext()

Many Greetings!
Remo

Well, first I would try installing the latest release in case it’s a bug that’s been fixed
https://www.emclient.com/dist/v8.0.3318/setup.msi

Second, can you try repairing that folder (right-click > properties > repair tab).

Third, try moving the emails out of that subfolder and then deleting it.

I had this problem yesterday. I contacted support and was given this as a starting point:

Go to Menu > Settings > Advanced > Logging

Check IMAP logging for the relevant account, and take note of the logging folder location.

Then restart eM Client.

Right-click your main Inbox folder of the account (for Gmail, it’s called All Inboxes) and click Properties.

And there click on the Repair button.

Then a log file will get created in the logging directory.

The file should have today’s date and “IMAP” in the filename.

At the end of the log, the same “Index was out of range. Must be non-negative…” error appeared, but with more detail: it showed the message causing the issue with enough detail (date, to, from, etc) to find it in webmail and delete it. Make sure your webmail actually expunges the message (not just marked for deletion). After that my red triangle problem went away.

But yeah, it is definitely a bug of some sort. Other mail clients are not bothered by whatever was causing the error.

1 Like

I installed the new version from the download section (Sidenote: emclient didn’t find an update) and “repaired” (cleared the cache) of the folder. Still the same problem. I wont delete mails because of a bug in emclient. Instead I will use Outlook in the meantime.

You don’t need to delete the emails. You can just move them to another folder temporarily (I would recommend local folders), delete the troublesome folder, and then re-add another folder with the same name and move the emails back.

Outlook is reading the folders and mails just fine. That’s why I initially wrote: “I’m trying to reach the emclient staff”.

I don’t see how someone outside the developer team can fix that issue.

You won’t delete one single email in order to get emclient working? That seems a bit inflexible. There are lots of workarounds, bugs and strange behavior in outlook as well, which is one reason I moved to emclient.

1 Like

I’m here to help find and fix a bug in emclient. How much more flexibility do you want? So could we please stay on topic? This forum doesn’t seem to have the functionality to mark and remove off topic messages.

Since when is providing a perfectly valid workaround not on topic?

They’re aware of the issue. I opened a support ticket for it. Perhaps you should do the same. My understanding is that the forum is for community support.