The strange case of VS 2010 (Beta 2 /CTPs) closing at startup or failing to create add-ins

As you know if you develop add-ins, Visual Studio 2005 introduced XML-based add-ins that use an .AddIn file that you must place in the proper folder for Visual Studio to show the add-in in the Add-In Manager. Which XML parser Visual Studio uses to parse .AddIn files wouldn’t be of interest if it wasn’t because for some people their Add-In Manager didn’t show XML-based add-ins… and the problem was solved installing MSXML. While I didn’t experience that problem personally, I have experienced a related problem with VS 2010 Beta2 and older CTPs.

The problem was that when I tried to create an add-in with the add-in wizard I got this misleading error message (misleading because I do have the proper language installed).

“An error occurred, and the wizard could not generate the project. Verify that the programming language is properly installed”

And more interestingly, if a place an .AddIn file (even an empty .AddIn file!) in one of the folders that VS scans for .AddIn files, VS 2010 fails to load with the following error message:

“The application cannot start”

and then it closes!

I remembered the problem of the empty Add-In Manager, I thought it could be related, so I verified with the Process Monitor tool that VS was certainly failing to get the MSXML2.Document.6.0 ProgId from the registry just before scanning folders for .AddIn files. I installed MSXML 6.0 and lo and behold, the problem was solved. 

So, I discussed this with several people inside the VS team and they confirmed that VS 2010 will use MSXML 6.0 to parse .AddIn files, etc. (I am not sure if VS 2005/2008 uses that version or older ones). It happens that I was using a virtual machine with Windows XP SP2, and it doesn’t include MSXML 6.0 (it includes MSXML 3.0 SP5), but VS 2010 Beta 2 / CTPs didn’t install it either. When I asked why VS 2010 didn’t install it as a prerequisite, the answer was that VS 2010 will require SP3 of Windows XP (which includes MSXML6), and the final release of VS 2010 will refuse to install on Windows XP SP2, something that the current betas / CTPs don’t enforce yet.

Now I hope that the Visual Studio Team modifies VS 2010 to show better behavior and diagnostics if, for whatever reason, Visual Studio doesn’t find the MSXML parser that it requires. We as developers tend to focus on code paths where things go as expected, and pay less attention to edge cases, but when things go bad, it causes a lot of pain to other people trying to diagnose and solve the problem. Something better than silent errors (empty Add-In Manager), crashes without further information or misleading error messages can be done…

2 thoughts on “The strange case of VS 2010 (Beta 2 /CTPs) closing at startup or failing to create add-ins”

  1. Hi Carlos,
    Just wanted to check if you have come across a problem that i am going to describe.
    Basically i have a desginer that i am trying to open and this designer has an embedded editor. Following is the code:

    IVsUIShellOpenDocument shell = (IVsUIShellOpenDocument)DesFMPkg.Instance.GetService(typeof(IVsUIShellOpenDocument));
    IOleServiceProvider sp = (IOleServiceProvider)DesFMPkg.Instance.GetService(typeof(IOleServiceProvider));
    Guid editorType = GuidList.guidMultiViewEditor;
    Guid logicalView = GuidList.guidDesignView;
    int hr;
    if (des.HasCodeEditorView)
    {
    IVsSolution vsSolution = (IVsSolution)DesFMPkg.Instance.GetService(typeof(SVsSolution));
    object obj;
    hr = vsSolution.GetProperty((int)__VSPROPID.VSPROPID_IsSolutionOpen, out obj);
    if (!(bool)obj)
    {
    hr = vsSolution.CreateSolution(string.Empty, string.Empty, (uint)__VSCREATESOLUTIONFLAGS.CSF_TEMPORARY);
    }
    }

    this.m_designer = des;
    string caption = “”;
    // Find the item id assigned to this document by the project.
    uint pitemid = VSConstants.VSITEMID_NIL;
    string moniker = des.Moniker;

    VSVirtualProject project = DesFMPkg.Instance.GetService(typeof(VirtualProject));
    IVsUIHierarchy hier = project as IVsUIHierarchy;
    IVsProject proj = project as IVsProject;

    hr = project.AddDesigner(des, out pitemid);
    ErrorHandler.ThrowOnFailure(hr);
    hr = shell.OpenSpecificEditor(
    (uint)0,
    moniker,
    ref editorType,
    null,
    ref logicalView,
    caption,//node.Caption,
    hier,
    pitemid,
    System.IntPtr.Zero,
    sp,
    out editorFrame);

    if (ErrorHandler.Succeeded(hr)) {
    editorFrame.SetGuidProperty((int)__VSFPROPID.VSFPROPID_InheritKeyBindings, ref GuidList.guidCmdUI_TextEditor);
    if (this.DontShowWindow == false)
    rrorHandler.ThrowOnFailure(editorFrame.Show());
    }

    on the EditorFrame.show, i get AccessViolationException. “Attempt to read to write protected memory”.
    Do you know if this is some known problem in Vs2010 Beta2?

    Thanks,
    Kalpana

Comments are closed.