0
votes

I tested a simple asynchronous FormRegionShowing event handler

    private async void MyForm_FormRegionShowing(object sender, System.EventArgs e)
        {                
          await Task.Delay(3000);
        }

When I debug this code in VS and await command works OK. FormRegionShowing event fires only once and only one MyForm instance is shown in email preview pane. However, when add-in is installed on test machine by add-in's setup program, FormRegionShowing event fires twice. As a result, two MyForm's are shown in preview pane. I attached Visual Studio 2015 debugger to OUTLOOK process and this is what I figured out. When event fires first time, the program leaves MyForm_FormRegionShowing method after it hits await Task.Delay(3000) command. Immediately after that, FormRegionShowing event fires second time. In this time, await Task.Delay(3000) command completes. But, because event was fired twice two MyForm instances are shown in email preview pane. Do you know why this happens? Thank you.

1
Somehow the form got broken. I removed it from add-in project and created a new one from scratch. This one works fine and async FormRegionShowing event handler works fine too.MBK

1 Answers

0
votes

Looks like the add-in or the pane was registered twice on the end user machine. I'd recommend creating a new sample add-in from scratch to make sure the issue doesn't depend on the pane or add-in.