0

I created my first Excel VSTO Add-in. Everything is working great in Visual Studio. I published my Add-in, installed on other computer but Excel has crashed during loading. Only not responding dialog was shown.

  • I was trying to create add-in for 2013 and newer versions
  • I set VSTO_SUPPRESSDISPLAYALERTS to 0 --> No alert shown
  • I tried to set VSTO_LOGALERTS to 1 --> No log
  • I checked register manifest value, path is correct
  • I tried to modify manifest value to wrong one --> Log was written with information about file not found
  • So I know that VSTO_LOGALERTS works but not for my case
  • I also checked this thread
  • Only information which I found in event log was:

Application: EXCEL.EXE Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.NullReferenceException at Microsoft.Office.Tools.Ribbon.RibbonBase.Dispose(Boolean) at ExcelTE.RibbonTE.Dispose(Boolean) at System.ComponentModel.Component.Finalize()

In prerequisites I have checked these options:

prerequisites

I also tried to install .NET framework 4.7.2 and Visual Studio Tools for Office runtime manually but without success.

Any ideas what else I can check?

aduguid
  • 3,099
  • 6
  • 18
  • 37
  • 3
    Possible duplicate of [What is a NullReferenceException, and how do I fix it?](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Lews Therin Apr 01 '19 at 14:17
  • I don't think so.. My code is working fine when debugging, problem is when Add-In is published.. – Josef Trejbal Apr 01 '19 at 14:21
  • Is ExcelTE your add-in? Does this happen on your dev machine when published? If so, you can attach Visual Studio's debugger and step through it to see exactly when this happens. – Chris Apr 01 '19 at 14:23
  • Yes ExcelTE is the name of my Add-In. Unfortunately on my dev machine everything working. Even when I try to install this add-in, so I can't use your approach. – Josef Trejbal Apr 01 '19 at 14:29

1 Answers1

0

I found solution for this problem.

The System.NullReferenceException was little bit misleading for this.

I created a project, then added:

  • Ribbon
  • On ribbon I've added button
  • For button I've created click event handler

I had my custom logic in event handler.It was using 3rd party library. This library requires to have Resources/someSettingsFile.settings folder in user Documents.

I was doing initialization of object from 3rd party library when MyRibbon class was created. So this throws exception during loading excel.

I forgot that I copied Resources folder to Documents during development and when I published Add-In to other users they simply doesn't have files required by 3rd library.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92