简体   繁体   中英

Outlook just hangs while debugging VSTO Addin

I am using Visual Studio 2013 and trying to develop a C# Outlook Add-In project for Outlook 2013 client installations at my enterprise employer.

What could cause Outlook to not load completely, ie upon pressing F5 to Start Debugging my application via the VS IDE , the Outlook Splash Screen loads for a second, but Outlook never actually loads. Via the Task Manager , I am able to see a process for Outlook running in the background, but it never materializes into an App process.

I have done the following: in the project's Properties page, I have set Outlook.EXE local path as the Start an external program and also set the working directory.

When I run my code "Start Without Debugging", Outlook indeed does load and I can run my Outlook Add-In , but I am not able to step through my code which, of course, is invaluable.

Any ideas on what I should maybe look for?

UPDATE:

As per @Sarvesh's answer, I created a new Outlook Add-In project without setting any Properties and just one line of code as shown and still the same behavior:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    Console.Writeline("ThisAddIn_Startup was called...");
}

In the project's Properties page, I have set Outlook's local path as the Start an external program and also set the working directory.

Why you have set these?

If you are developing VSTO addin using templates provided by VS, you don't need to set these properties manually.

Set it back to default and then Debug.

Be aware, only one instance of Outlook can be run at the same time. So, first of all check out the list of running processes for Outlook.exe before starting your project. Only then you can start your add-in under the debugger.

Also I'd suggest disabling all other add-ins in Outlook. Outlook may disable add-ins that take a lot of time for loading. Try to reproduce the issue with a newly created empty add-in project. Set a breakppoint to the Startup event handler and run it under the debugger. Does it work?

Outlook 2013 monitors add-in performance metrics such as add-in startup, shutdown, folder switch, item open, and invoke frequency. Outlook records the elapsed time in milliseconds for each performance monitoring metric.

For example, the startup metric measures the time required by each connected add-in during Outlook startup. Outlook then computes the median startup time over 5 successive iterations. If the median startup time exceeds 1000 milliseconds (1 second), then Outlook disables the add-in and displays a notification to the user that an add-in has been disabled. The user has the option of always enabling the add-in, in which case Outlook will not disable the add-in even if the add-in exceeds the 1000 millisecond performance threshold.

Make sure that the add-in is always enabled.

See Performance criteria for keeping add-ins enabled for more information.

I had this same issue just recently - I resolved it by building and installing the addin in Outlook, which when launched threw an error and popped up with the exception.

In the end, the solution to my issue was to create a registry key in the 64-bit hive named EnableVSTOLocalUNC set to value 00000001 (as a dword) in the key [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Vsto Runtime Setup\\v4] .

Here are some other potential issues you may come across once you've installed the addin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM