I've been trying to process an entire e-mail folder and I have experienced some OutOfMemory exceptions, IndexOutOfRange exceptions and attachments not being correctly populated.
So I've downloaded the latest source code and tried to debug BodyStructureParser.Parser.
I've found some issues which seemed to fix all problems I had been getting, but as I'm no IMAP expert I'm not sure whether this can affect other scenarios.
__DropExtensionData:__
```
if (braces <= 0)
break;
```
This was replaced with "braces < 0".
__ReadUnquotedString:__
```
var charCount = int.Parse(sb.ToString());
_reader.Read();
```
I removed the "_reader.Read()" which was causing it to skip the first character of the string and adding one extra character to the end, possibly corrupting everything onwards.
So I've downloaded the latest source code and tried to debug BodyStructureParser.Parser.
I've found some issues which seemed to fix all problems I had been getting, but as I'm no IMAP expert I'm not sure whether this can affect other scenarios.
__DropExtensionData:__
```
if (braces <= 0)
break;
```
This was replaced with "braces < 0".
__ReadUnquotedString:__
```
var charCount = int.Parse(sb.ToString());
_reader.Read();
```
I removed the "_reader.Read()" which was causing it to skip the first character of the string and adding one extra character to the end, possibly corrupting everything onwards.