Re: VS crash during addin uninstalling

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Carlos J. Quintero [MVP] (carlosq_at_NOSPAMsogecable.com)
Date: 06/23/04

  • Next message: Hakan ?zaslan: "Re: Setup project and dependencies"
    Date: Wed, 23 Jun 2004 09:56:49 +0200
    
    

    Some ideas:

    1) Try to get the exception message. It seems that you are catching and
    silencing the exceptions. Use MessageBoxes.

    2) If that fails, try to trim your code until you find the culprit. FOr
    example, you are doing 3 things: removing controls from command bar,
    removing commandbar and removing commands. Surely only one of the 3 is
    causing the problem... so try to isolate which one executing only one in
    each test.

    -- 
    Carlos J. Quintero (Visual Developer - .NET MVP)
    FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
    addins:
    http://groups.yahoo.com/group/vsnetaddin/ (free join)
    "Szymon Madejczyk" <smad@parasoft.com.pl> escribió en el mensaje
    news:cb9j7g$5uf$1@nemesis.news.tpi.pl...
    > Hello,
    >
    > I encountered strange problem. When following code is compiled in Debug it
    works
    > ok. However when I compile it in Release. During uninstal VS .net 2003
    display
    > crash warning. What is more no exception is thrown.
    > BTW addins are removed properly.
    >
    > Someone has idea what I do wrong.
    >
    > thanks
    > Szymek
    >
    > using System;
    > using System.Collections;
    > using System.Diagnostics;
    > using System.IO;
    >
    > using EnvDTE;
    > using Microsoft.Office.Core;
    >
    > namespace AddinRemover
    > {
    > public sealed class Remover
    > {
    > private Remover()
    > {
    > } // private Cleaner()
    >
    > private const string VS_71_PROG_ID = "VisualStudio.DTE.7.1";
    > private const string VS_70_PROG_ID = "VisualStudio.DTE.7";
    > private const string ADDIN_NAME_COMMON_PART = "MyAddIn";
    > private const string CMD_BAR_NAME = "My";
    > private const string ADDIN_NAME = "My";
    >
    > private static void RemoveAddin(string progId)
    > {
    > Type vsType = Type.GetTypeFromProgID(progId);
    > if (vsType != null)
    > {
    > object dteObj = Activator.CreateInstance(vsType);
    > if (dteObj != null)
    > {
    > DTE dte = (DTE)dteObj;
    > try
    > {
    > RemoveCommands(dte);
    > }
    > catch(Exception e)
    > {
    > Exception exp = e;
    > }
    > //dte.Quit();
    > dte = null;
    > GC.Collect();
    > }
    > }
    > }
    >
    > private static void RemoveCommands(DTE dte)
    > {
    > Commands cmds = dte.Commands;
    > _CommandBars commandBars = dte.CommandBars;
    >
    > try
    > {
    > CommandBar toolCommandBar = (CommandBar)commandBars["Tools"];
    > CommandBarControls ctrls = toolCommandBar.Controls;
    > IEnumerator en = ctrls.GetEnumerator();
    > while(en.MoveNext())
    > {
    > CommandBarControl ctrl = (CommandBarControl)en.Current;
    > if (CMD_BAR_NAME == ctrl.Caption)
    > {
    > ctrl.Delete(false);
    > }
    > }
    > }
    > catch(Exception /*e*/)
    > {
    > //TODO: logging
    > }
    >
    > foreach(Command cmdDel in cmds)
    > {
    > if (cmdDel != null && cmdDel.Name != null &&
    > cmdDel.Name.IndexOf(ADDIN_NAME_COMMON_PART) >= 0)
    > {
    > try
    > {
    > cmdDel.Delete ( ) ;
    > }
    > catch(Exception /*e*/)
    > {
    > //TODO: logging
    > }
    > }
    > }
    >
    > try
    > {
    > CommandBar cmdBar = (CommandBar)commandBars[CMD_BAR_NAME];
    > cmds.RemoveCommandBar(cmdBar);
    > }
    > catch(Exception /*e*/)
    > {
    > //TODO: logging
    > }
    > }
    >
    > public static void Main(string[] args)
    > {
    > try
    > {
    > Remover.RemoveAddin(VS_70_PROG_ID);
    > }
    > catch(Exception /*e*/)
    > {
    > //TODO: logging
    > }
    >
    > try
    > {
    > Remover.RemoveAddin(VS_71_PROG_ID);
    > }
    > catch(Exception /*e*/)
    > {
    > //TODO: logging
    > }
    > }
    > }
    > }
    

  • Next message: Hakan ?zaslan: "Re: Setup project and dependencies"

    Relevant Pages

    • RE: debugging with application verifier
      ... the exception record and context record. ... 0012ED8C: Exception record. ... Where should I run this commands given in documentation? ... I see log file window. ...
      (microsoft.public.win32.programmer.tools)
    • Re: [2.6.21.1] SATA freeze
      ... Something is issuing SMART-related commands which the drive seems to be reacting strangely to. ... Previously on 2.6.15 I was seeing sdb remount as readonly under heavy i/o. ... Device does not support SMART ... [GLTSD (Global Logging Target Save Disable) set. ...
      (Linux-Kernel)
    • Re: logging executed commands on Cisco switch
      ... logging timestamp ... I would like to configure the switch to do the same. ... information about executed commands is not. ... Any idea what is missing in my switch configuration? ...
      (comp.dcom.sys.cisco)
    • Re: logging command line activity
      ... the logging without it being obvious. ... Karl Vogel and Gerhard Weick. ... including capturing the output from commands, ... Script from Karl Vogel: ...
      (SunManagers)
    • Re: But Microsoft cant help. At least Microsoft India cant.
      ... Copy the following commands and then paste them into the opened Notepad ... After you paste the above commands, please close the Notepad window. ... the debugging tools on my system. ... An unhandled exception of type ...
      (microsoft.public.windowsupdate)