Empty Outlook add-in leads to immediate crash

2

Environment: VS 2015 Community Edition Update 3; Outlook 2016; Windows 10 x64; latest patches applied for all.

When creating a new Outlook add-in using VSTO and C#, Visual Studio creates an empty project. (Due to the fact it's just boilerplate on an empty project I won't include it here.) However, attempting to launch this empty project leads to an immediate Outlook crash:

FatalExecutionEngineError occurred

Message: Managed Debugging Assistant 'FatalExecutionEngineError' has detected a problem in 'C:\Program Files (x86)\Microsoft Office\root\Office16\outlook.exe'.

Additional information: The runtime has encountered a fatal error. The address of the error was at 0x730e1302, on thread 0xfb4. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

I've put breakpoints on both the InternalStartup and ThisAddIn_Startup methods; the exception gets thrown before either is hit. I've also tried building as x86, as x86_64, and as Any CPU, to no avail.

Can anyone give me guidance on what's going wrong here?

c#
visual-studio-2015
outlook
vsto
outlook-addin
asked on Stack Overflow Oct 26, 2017 by Rob Hansen

1 Answer

1

Answer: by default, new add-ins are Debug builds, and hitting F5 runs them in debugging mode, which is even more slow. This is a problem for Outlook, which treats slow add-ins as being inherently defective, marks them as broken, and aborts Outlook so that the next time Outlook starts it can skip the 'broken' plugin.

Switching my code to a Release build and doing a normal run, without debugging support, resolved the issue.

answered on Stack Overflow Oct 27, 2017 by Rob Hansen

User contributions licensed under CC BY-SA 3.0