We have a taskpane add-in on Outlook. When it is opened, it adds an attachment handler using Office.context.mailbox.item.addHandlerAsync(). When the taskpane is closed, we remove the attachment handler. While further processing the attachment, the attachment handler deletes the attachment from Outlook’s compose window using Office.context.mailbox.item.removeAttachmentAsync().
The issue is, when the taskpane is closed, the attachment handler is not getting removed.
Even after the taskpane is closed, the attachment handler is still remaining active. As a result, any attachment that is added even after closing the taskpane gets deleted after some time. This issue is NOT observed on any platform other than Outlook on Mac (new UI).
We have tried to recreate this issue in different platforms, but it cannot be observed in Outlook on Windows (new UI) or on Outlook on the web.