PST Merge Exception - Aspose Email for .NET

I’m using the PersonalStorage.MergeWith(string[] sourceFileNames) method in the 20.2.0 Aspose Email for .NET release.

I’m merging two PSTs that are roughly 3GB and 7GB respectively. These PSTs separately have no issues - I’ve run ScanPST on them. When merging them, I get the following exception. The obfuscation in the stack trace gives me no real clues as to what might be happening:

System.InvalidOperationException: Could not read message —> System.ArgumentOutOfRangeException: capacity was less than the current size.
Parameter name: value
at System.IO.MemoryStream.set_Capacity(Int32 value)
at Aspose.Email.Mapi.MapiMessage.#=zP8bDuSg=(Stream #=zPTjZgxU=)
at Aspose.Email.Mapi.MapiMessage.#=z1KtjkrWaqIrP(Stream #=zPTjZgxU=, #=zYjZLkg8lc7NjUdr6oSjX1u7pBKp7NPteCw== #=zeBwJsbw=, MsgSaveOptions #=z6Bm6gT0=)
at Aspose.Email.Mapi.MapiMessage.Save(Stream stream)
at Aspose.Email.Mapi.MapiObjectProperty…ctor(MapiMessage #=zaeEC9$Y=)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zdc_JojrYEF4v(#=zRkijF5krzLNJxaOzeBweCY0o4vmSsuHEdjUah1M= #=zzJ_0x82JeQsv)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zGdq8Fz8=(#=zRkijF5krzLNJxaOzeBweCY0o4vmSsuHEdjUah1M= #=zzJ_0x82JeQsv, MapiMessage #=zaeEC9$Y=)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zdc_JojrYEF4v(#=zRkijF5krzLNJxaOzeBweCY0o4vmSsuHEdjUah1M= #=zzJ_0x82JeQsv)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zAQTNcMU=(#=zSymeQKUxGle7vDFcj2mqp$F8BNLU$Fg7zA== #=zhaOOnI6_CAZJ)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zGdq8Fz8=(#=zSymeQKUxGle7vDFcj2mqp$F8BNLU$Fg7zA== #=zhaOOnI6_CAZJ, MapiMessage #=zaeEC9$Y=)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zGdq8Fz8=(UInt32 #=zoEkZnMo1CiAs, MapiMessage #=zaeEC9$Y=)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zc8OBHVY=(UInt32 #=zoEkZnMo1CiAs)
— End of inner exception stack trace —
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zc8OBHVY=(UInt32 #=zoEkZnMo1CiAs)
at #=zdBFK73Ib03_01AdorfmzWjkcY9t1VqTlA6IDPGE=.#=zz4j2Zrtxy5Nk.MoveNext()
at Aspose.Email.Storage.Pst.FolderInfo.MergeWith(FolderInfo sourceFolder, Boolean recursiveHandler)
at Aspose.Email.Storage.Pst.PersonalStorage.#=zJurRD80=(FolderInfo #=zjz1w6T0BIZaQ, FolderInfo #=z4bDTsBmcP2Sz)
at Aspose.Email.Storage.Pst.PersonalStorage.#=zTjyKzXA=(String #=znkDkMa8=)
at Aspose.Email.Storage.Pst.PersonalStorage.MergeWith(String[] sourceFileNames)
at Zipline.Core.PstBuilderV4.Build(PstBuilderSettings settings, CancellationToken ct) in z:\RVM 2G Apps\Zipline\Trunk\Zipline\Zipline.Core\PstBuilderV4.cs:line 188

@jnelson.rvminc,

I have observed the issue shared by you and request you to please first try using latest Aspose.Email for .NET 20.3 on your end. In case there is still an issue then please share the source flle and working sample code with us.