开发者

Uninstalling my Office 2010 plugin leaves a null pointer exception

开发者 https://www.devze.com 2023-02-22 21:57 出处:网络
I\'ve been trying to track down why my Office2010 plugin leaves a null pointer exception during uninstall and the 2007 version does not. (Edit: 2007 is at same state as 2010 - FAIL)

I've been trying to track down why my Office2010 plugin leaves a null pointer exception during uninstall and the 2007 version does not. (Edit: 2007 is at same state as 2010 - FAIL)

To narrow it down I have put in a couple of eventlog traps, meaning if code reaches this point - I should get something in the Eventlog. No such luck. Now either I written the eventlog trap wrong or code doesn't reach that point.

In the CustomSetupActions - ClickOnceInstaller.cs

    public void Uninstall(System.Collections.IDictionary savedState)  
    {  
        // write something to eventlog  
        // This is not being fired, the exception doesn't reach here or writing to eventlog fails.  
        if (!EventLog.SourceExists("OfficePlugin"))  
        {  
            EventLog.CreateEventSource("OfficePlugin", "Application");  
        }  
        EventLog.WriteEntry  
            ("OfficePlugin"  
            , string.Format("Uninstalling: (bug hunting)"), EventLogEntryType.Information);

        string deploymentLocation = (string)savedState["deploymentLocation"];
        if (deploymentLocation != null)
        {
            string arguments = String.Format(
                "/S /U \"{0}\"", deploymentLocation);
            ExecuteVSTOInstaller(arguments);
        }
    }

As for the ExecuteVSTOInstaller(string arguments)

2007 refers to: string subPath = @"Microsoft Shared\VSTO\9.0\VSTOInstaller.exe";

2010 refers to: string subPath = @"Microsoft Shared\VSTO\10.0\VSTOInstaller.exe";

If the first trap had fired, this is where I would have placed th开发者_开发问答e trap afterwards.

--

I have another method that handles the registration db

RegisterOffice2010AddIn.cs

    public void UnRegisterAddIn(string applicationName, string addInName)
    {

Next line is precisely the same eventlog trap as I just used/shown.

Difference between the two (2007 vs 2010).

    private const string UserSettingsLocation =
        @"Software\Microsoft\Office\12.0\User Settings";

vs

    private const string UserSettingsLocation =
        @"Software\Microsoft\Office\14.0\User Settings";

I can't think of any other place that might be interesting to place the trap. I have a CustomInstaller which doesn't do anything besides Dispose(bool disposing) and InitializeComponent()

Development:

Action start 14:21:00: PublishFeatures.

Action ended 14:21:00: PublishFeatures. Return value 1.

Action start 14:21:00: PublishProduct.

Action ended 14:21:00: PublishProduct. Return value 1.

Action start 14:21:00: InstallExecute.

MSI (c) (B8:BC) [14:21:01:013]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

Error 1001. Error 1001. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. --> Object reference not set to an instance of an object.

DEBUG: Error 2769: Custom Action _EE8A0D36_BE55_421F_9A55_95470C001D87.uninstall did not close 1 MSIHANDLEs.

The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: _EE8A0D36_BE55_421F_9A55_95470C001D87.uninstall, 1,

Action ended 14:21:05: InstallExecute. Return value 3.

Action ended 14:21:06: INSTALL. Return value 3.

Googling the Error 2769 - gives an answer of "[TARGETDIR]\" , but I dont reference TargetDir, I reference deploymentLocation. And Yes I have tried adding the "\" to places I could think of. Including the setup - Registry - HKLM\Software\MS\Office\12.0\ ...etc... \Addins\Excel/Word/Outlook and the Manifest keyvalue. Gave no feedback, good or bad, errors or otherwise. I'm at a loss what else to try to hunt this one down.

I have a guess it is referencing to this, in the VDPROJ:

{

"Name" = "8:UnregisterOutlookAddIn"

"Condition" = "8:"

"Object" = "8:_73E71A44EB72485AB7367745F7D57F49"

"FileType" = "3:1"

"InstallAction" = "3:4"

"Arguments" = "8:"

"EntryPoint" = "8:"

"Sequence" = "3:3"

"Identifier" = "8:_EE8A0D36_BE55_421F_9A55_95470C001D87"

"InstallerClass" = "11:TRUE"

"CustomActionData" = "8:/addinName=\"OUR.Outlook.Outlook2010AddIn\" /application=\"Outlook\""

}

I found it throws two exception - the secondary under CustomSetupActions and UnregisterAddIn and the primary under ClickOnceInstaller and Uninstall. Howcome I mention them as 2ndary and primary. Well it will do the exception in CustomAction and then the killing one in ClickOnce. I've eliminated the one in CustomActions and I now only have to worry about the ClickOnce. From what I can gather the ClickOnce implements the interface specified in the Setup Project (Install, Rollback, Commit, Uninstall). I only have to figure out how it can run amiss the Uninstall method.

Disclaimer: Unless ofcourse I'm mistaken and is barking up the wrong tree.


Change to WiX. It became a workaround as the original is still true.

0

精彩评论

暂无评论...
验证码 换一张
取 消