OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
688 stars 95 forks source link

Outlook Crash in Legacy Mac UI with Mixed Attachments #5034

Open sagarkhatriseclore opened 2 weeks ago

sagarkhatriseclore commented 2 weeks ago

Expected Behavior

Mail should get send without any issue.

Current Behavior

I’m encountering an issue in the legacy UI on Mac where Outlook crashes under one specific condition: when both an inline attachment and a regular attachment are added to the email. All other cases work without issue in the legacy UI on Mac.

However, I’m encountering an issue in the legacy UI on Mac where Outlook crashes under one specific condition: when both an inline attachment and a regular attachment are added to the email. All other cases work without issue in the legacy UI on Mac.

We are specifically seeing this issue on outlook 16.90, everything is working fine on 16.88.

Your Environment

Useful logs

Dump of the crash:

Microsoft Error Reporting log version: 2.0
Error Signature:
Exception: EXC_BAD_ACCESS
ExceptionEnumString: 1
Exception Code: KERN_INVALID_ADDRESS (0x00001903694d71a0)
Date/Time: 2024-10-31 12:59:24 +0000
Application Name: Microsoft Outlook
Application Bundle ID: com.microsoft.Outlook
Application Signature: OPIM
Application Bitness: x64
Application Version: 16.90.2.24102719
Crashed Module Name: Microsoft Outlook
Crashed Module Version: 16.90.24102719
Blame Module Name: Microsoft Outlook
Stack Trace:
#1 0x0000000105e65584 in (Microsoft Outlook + 0x0000000001295584)
#2 0x000000018ba57180 in ___CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (CoreFoundation + 0x0000000000073180)
#...
mmanjaree-msft commented 2 weeks ago

@sagarkhatriseclore Are attachments added by addin? Is the issue still there when you try to add attachments manually without any addin?

sagarkhatriseclore commented 2 weeks ago

Yes, the regular attachment is added by the add-in, while the inline attachment is manually added in the compose pane. In this scenario, we encounter the issue on the legacy Outlook for Mac (version 16.90).

There are no issues if attachments are added manually.

Additionally, if only regular attachments are added by the add-in (with no inline attachments), we don’t experience any problems.

The failure scenario—where an inline attachment is manually added alongside regular attachments added by the add-in—works fine on Windows and in all browsers.

sagarkhatriseclore commented 2 weeks ago

Hi team, @mmanjaree-msft , good day! I wanted to follow up to see if there’s any update on this. This issue is impacting us and our customer, so any help would be greatly appreciated

mmanjaree-msft commented 2 weeks ago

Thanks for the info provided. We are trying to get a repro for the issue mentioned above. Will keep this post updated. Just to clarify, problematic scenario is only when an inline addin is present and addin adds an attachment (in any order)

sagarkhatriseclore commented 2 weeks ago

Thank you @mmanjaree-msft for your quick reply.

Yes, the problematic scenario occurs only when an inline attachment is present, and the add-in adds an attachment (in any order). One key observation we've made is that it fails only if the add-in also calls the saveMail Office.js API.

anjalitp commented 2 weeks ago

@sagarkhatriseclore We are not able to reproduce the crash on our side. Could you please provide exact repro steps before the crash occurs including the part where Add-in calls saveAsync API? You could also share the repro video if possible. Also, please share the entire crash log with us.

sagarkhatriseclore commented 2 weeks ago

Hi @anjalitp ,

I am reaching out to provide the detailed steps to reproduce an issue we've encountered with the Outlook add-in. Below are the steps that lead to a crash in the Outlook client.

Steps to Reproduce:

  1. Click on New Mail.

  2. Add 1 inline attachment.

  3. Add a regular attachment.

  4. Launch the Add-in: The add-in will fetch the attachments, remove them from the compose pane for processing, perform specific tasks on each attachment, and call saveAsync every 5 seconds if a certain condition is met during attachment fetching and processing.

  5. Click Send: On sending, the add-in will re-add the attachments back to the compose pane. After the attachments are re-added and the add-in has completed its work, when Outlook attempts to send the email, it crashes.

Outlook Error Dump.txt

If only a regular attachment is added (without an inline attachment), the same processing steps occur in the add-in, but Outlook functions as expected without crashing. I've attached a screen recording of the issue and the crash dump for your review.

Please let us know if further details are needed to address this issue.

https://github.com/user-attachments/assets/9f7b790b-34a5-4cec-9eae-70fa3bddaf0c

PratikSavla commented 1 week ago

Hi, even I am facing similar issue. Following are the details:

Issue: Outlook client crashes when sending a mail with inline attachment while task pane add-in has Office.EventType.AttachmentsChanged event handler attached to it.

Repro steps (Step by Step):

  1. Deploy an xml outlook officejs add-in which has an event handler for attachments changed in taskpane.
  2. Draft a mail with at least 1 inline attachment.
  3. Invoke taskpane add-in. Make sure Attachments Changed event handler is running in background.
  4. Click on the send button.

Expected Behavior: Mails should be sent successfully. Outlook client should not crash. Actual Behavior: Outlook crashes when the send button is clicked.

Sample code (script lab yaml):

name: Blank snippet
description: Create a new snippet from a blank template.
host: OUTLOOK
api_set: {}
script:
  content: |
    $("#run").on("click", run);

    function run() {
      Office.context.mailbox.item.addHandlerAsync(Office.EventType.AttachmentsChanged, (val) => { console.log("recieved event::", JSON.stringify(val)); }, () => { console.log("added handler successfully");});
    }
  language: typescript
template:
  content: |
    <button id="run" class="ms-Button"><span class="ms-Button-label">Run</span></button>
  language: html
style:
  content: |-
    section.samples {
        margin-top: 20px;
    }

    section.samples .ms-Button, section.setup .ms-Button {
        display: block;
        margin-bottom: 5px;
        margin-left: 20px;
        min-width: 80px;
    }
  language: css
libraries: |
  https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js
  @types/office-js
  office-ui-fabric-core@11.1.0/dist/css/fabric.min.css
  office-ui-fabric-js@1.5.0/dist/css/fabric.components.min.css
  core-js@2.4.1/client/core.min.js
  @types/core-js
  jquery@3.1.1
  @types/jquery@3.3.1
anjalitp commented 1 week ago

Thanks for providing more details. We have an in-house repro of this issue. This has been added to our backlog. Unfortunately, we do not have a timeline to share at this point.