简体   繁体   中英

Excel COM-Add-in crash after deploying VSTO

I recently developed a Excel COM-addin in C# using VS2010 which uses a Web reference to a remote Web service and sends data to and from the service. Once this was finished as per therequirements I followed the steps here to get it installed on multiple client computers.

After the msi gets built as per the specifications, I installed the add-in on an external computer. After the installation completes successfully I try to launch excel and it crashes. On further investigation, I managed to get to the Windows Error report(WERInternalMetadata.xml) file that has this piece of code.

<ProblemSignatures>
    <EventType>CLR20r3</EventType>
    <Parameter0>excel.exe</Parameter0>
    <Parameter1>14.0.6126.5003</Parameter1>
    <Parameter2>505b0834</Parameter2>
    <Parameter3>AddInTestExcel2007</Parameter3>
    <Parameter4>1.0.0.0</Parameter4>
    <Parameter5>53304e03</Parameter5>
    <Parameter6>42</Parameter6>
    <Parameter7>16</Parameter7>
    <Parameter8>System.NullReferenceException</Parameter8>
</ProblemSignatures>

When I debug my add-in on Visual Studio I dont get a NullReference Exception. Apart from this I have no other information on what is causing excel to crash. Could someone please help me interpret this?

EDIT - AddIn StartUp code

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{

}

private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{

}

typically, an Excel Add-in can crash on start-up of Excel for following reasons:

  1. there is code in the start-up of the add-in which is not try/catch encapsulated.
  2. the start-up code expects config or web service urls which are not present in the expected files.
  3. the code encountered different run time conditions (an actual deployed machine) vs. running it in a Visual Studio Environment with expected permissions/office installed/.net versions installed etc.

can you please check your start up code and look for possible exceptions by wrapping it in a generic try/catch block?

you can also post the snippet here and we can help identify as well.

ps the general recommendation is to keep start-up code to a minimum if not zero. this is because modern versions of office apps like outlook actually disable an add-in if the load time is more than a particular value.

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