Outlook 2019 crashes when F1 key pressed in a form created by add-in

Add-in Express™ Support Service
That's what is more important than anything else

Outlook 2019 crashes when F1 key pressed in a form created by add-in
 
Subscribe
AdrianP




Posts: 13
Joined: 2024-05-25
Hello,

I'm about to finish my Outlook plugin and I thought to add some context help for the config panel.

Fiddling with F1 key to see if the help events in my config dlg. fire correctly, I uncovered a surprise :-)
Basically, each time F1 is pressed second time in the dialog window, Outlook crashes completely (closes and complains about the add-in at next restart, disabling it). I haven't written any code for help, shortcuts or any other kb processing.

I was able to reproduce it with a new C# project:

1. Create a new ADX com add-in, just for Outlook, versions 2016-2021;
2. Add a ribbonTab, a ribbonGroup and a ribbonBtn;
3. Add new form to project, with no controls on it;
4. On the ribbonBtn OnClick event, display the form modally;


Form1 form1 = new Form1();
form1.ShowDialog();
form1.Dispose();


5. Build as release, register the add-in;
6. Open Outlook 2019, click on the ribbonBtn, form1 shows;
7. Press F1, Outlook will open a browser window "How can we help you?" (most likely becasue it has nothing associated with our add-in, helpwise);
8. Return to our form1, which is still open, and press F1 a second time. Now, instead of opening a browser, Outlook thinks for a bit and perishes :-)

What I tried, with no effect:
- changed the .NET target framework from 4.5 to 4.7.2;
- wrote an OnError event, but no exception is caught;

What I tried, with great effect:
- write an empty HelpRequested event for the form1, just to trap the F1 and prevent sending it down the line to Outlook;

I use VS2022, latest ADX version, Office 2019, Win10 box.

So, what do you think?

Regards!
Posted 25 May, 2024 07:05:07 Top
Andrei Smolin


Add-in Express team


Posts: 18965
Joined: 2006-05-11
Hello Adrian,

We reproduce this issue with a VSTO add-in. We suppose this relates somehow to modality: when you open a modal window, its messages are handled by the .NET Framework (specifically, in System.Windows.Forms Application), not by Outlook.

Regards from Poland (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2024 07:57:34 Top
AdrianP




Posts: 13
Joined: 2024-05-25
Hello Andrei and thanks for answering,

Yes, it looks like that. The moment you assign a HelpRequested event (even a empty one) to the form, problem dissapears.
Using a HelpProvider component on the form works as well.

Was a very nice experience working with ADX, not so nice dealing with Outlook quirks, but such is life :-)

Regards
Posted 28 May, 2024 13:59:52 Top
Andrei Smolin


Add-in Express team


Posts: 18965
Joined: 2006-05-11
Thank you!

Regards from Poland (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 28 May, 2024 14:09:43 Top