+1 vote
by (150 points)
edited

Hello all,

I am getting the following exception while trying to save an email with attachments.

Exception says the following.

Cannot get entity content stream because it is currently in use. Make sure to call the Close method on streams returned by MimeEntity.GetContentStream.
Rebex.Mime.MimeException: Cannot get entity content stream because it is currently in use. Make sure to call the Close method on streams returned by MimeEntity.GetContentStream.
   at Rebex.Mime.MimeEntity.GetContentStream(Boolean writable)
   at Rebex.Mail.Attachment.D(Boolean A)
   at Rebex.Mail.MailMessage.WD(SQ A, AttachmentBase B, String C, String D)
   at Rebex.Mail.MailMessage.SD(MailFormat A)
   at Rebex.Mail.MailMessage.RD(Stream A, MailFormat B)
   at Rebex.Mail.MailMessage.Save(String fileName, MailFormat format)
   at XXXXXXX.Decryption.SecureMail.MailMessage.ToMime(String fileName)

I am getting the above exception while trying to save a Rebe.Mail.MailMessage.

Thanks.

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (58.9k points)
edited by

UPDATE

There was actually a bug in the component (versions 2013R2 and 2013R3 are affected) - we did not close an opened Stream under certain circumstances. It is now fixed and the fix is part of 2014R1 version.


However, if you still get the same exception even with our fix, please make sure that you always properly close the Stream returned by the public MimeEntity.GetContentStream method! As it finally turned out to be the problem (although we discovered and fixed a bug at our side as well during the proccess.)


For trial users - here is a trial version of the hotfix. A full-version for users with an active Support Contract is available on demand, just let us know either here or at support@rebex.net.

...