Search code examples
comoffice-interoponenoteonenote-api

OneNote 2016 Add-in won't load. How to debug? More updated sample?


I am trying to implement a OneNote Add-In and was surprised at the lack of Microsoft support. I am using Office Pro 2016. I found after hours of googling

  1. http://www.malteahrens.com/#/blog/howto-onenote-dev/
  2. https://github.com/OneNoteDev/VanillaAddIn

but upon implementing them both of them lead me to the same result - the Add-in is deployed but it fails to become active. The following error message is displayed in "COM Add-ins" dialog: "Load Behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in" I tried to debug following the steps from here (https://blogs.msdn.microsoft.com/vsod/2008/04/22/troubleshooting-com-add-in-load-failures/) without any result. I also tried to enable OneNote Add-in logging following the steps from here (OneNote 2013 Add-in won't load. How to debug?) again without any results, the log file is not created, probably the steps for Office 2016 are different.

Any help would be greatly appreciated. A VS project template? Another more updated tutorial/sample? Any suggestions to investigate/fix the "runtime error occurred during the loading of the COM Add-in"


Solution

  • First of all, make sure that all the required prerequsites were installed before the add-in was tried to load. Then add log statements to the code to see where exactly it fails. Do you get any exceptions in the code?

    Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.

    Hard disabling can occur when an VSTO Add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event handler in your VSTO Add-in is executing.

    Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing. Read more about that in the How to: Re-enable a VSTO Add-in That Has Been Disabled article.

    Is the VBA macro policy applied to COM add-ins? Are unsigned COM add-ins allowed to load?

    Do you try to load a x86 based plugin into the x64 based host? Or the opposite?