InvalidCastException trying to replace an attachment's ContentStream

The following code:

var appointment = Appointment.Load("input.ics");
appointment.Attachments.First().ContentStream = File.OpenRead("test.txt");
appointment.Save("output.ics");

results in an InvalidCastException:

Unable to cast object of type 'System.IO.FileStream' to type 'System.IO.MemoryStream'.
   at Aspose.Email.Attachment.g()
   at Jh.a(Appointment a)
   at Jh.c()
   at Jh.Jha3taa()
   at Aspose.Email.Calendar.CalendarWriter.Write(Appointment appointment)
   at Aspose.Email.Calendar.Appointment.Save(Stream stream, AppointmentSaveOptions saveOptions)
   at Aspose.Email.Calendar.Appointment.Save(String filePath, AppointmentSaveOptions saveOptions)
   at Aspose.Email.Calendar.Appointment.Save(String filePath, AppointmentSaveFormat saveFormat)
   at SafeBridge.Providers.BufferzoneCDR.AppointmentCDR.<BridgeFileAsyncInternal>d__1.MoveNext() in T:\SafeWorkspace\sw-

However, ContentStream is defined as:

public Stream ContentStream { get; set; }

and described in the docs as:

AttachmentBase.ContentStream property
Gets or sets the content stream.

I would expect to be able to set this property to any Stream derived type. This should either be documented and defined as a MemoryStream or, preferrably, should accept any Stream-derived type.

What if an attachment is very large? Confining this to a MemoryStream is wasteful and might not work on all systems, where memory is low.

@Buffer2018
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes asap.

Issue ID(s): EMAILNET-41252