Sicos1977 / MSGReader

C# Outlook MSG file reader without the need for Outlook
http://sicos1977.github.io/MSGReader
MIT License
490 stars 168 forks source link

Large EML File Reading Error #361

Closed DisIsAbhi closed 1 year ago

DisIsAbhi commented 1 year ago

When i try to Parse an EML file with 2.75GB size using var finfo = new FileInfo(_fileName); using var strm = finfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); _eml = Message.Load(strm);

I get the following Error. Array dimensions exceeded supported range. StackTrace: - at Microsoft.IO.RecyclableMemoryStream.ToArray() in /_/src/RecyclableMemoryStream.cs:line 840 at MsgReader.Mime.Message.Load(Stream messageStream)

Sicos1977 commented 1 year ago

You can overload the RecyclableMemoryStream throught this class https://github.com/Sicos1977/MSGReader/blob/master/MsgReaderCore/Helpers/StreamHelpers.cs . You probably need to set a new memorystream manager so that it fits your very large files.

See this link about how this works --> https://github.com/microsoft/Microsoft.IO.RecyclableMemoryStream