none
VS 2008 closes at build, Outlook 2007 Add-In

    Question

  • Visual Studio 2008 abruptly closes when I try to build an Outlook 2007 Add In.

     

    My workstation is configured as follows:

     

    Originally I thought this was a code problem in my add-in, or that perhaps my PC needed to be rebooted.  This morning I powered off and rebooted.  Additionally, I read that Outlook needed to be closed before building an add-in.  I also tried that, but it still did not work.  Steps to replicate my problem are below.

     

    Steps to replicate my problem.

    1. Boot computer and do not open Outlook.
    2. Open VS 2008
    3. Select File > New Project > Visual C# > Office > 2007 > Outlook 2007 Add-In.
    4. Choose the default name and then OK.
    5. Select Build > Build OutlookAddIn1.

    I suspect that this may be related to the registry settings that VS 2008 attempts to make when it builds an Add-In.  Here is an excerpt from Professional C# 2008 that lead me to this hypothesis.

     

    Managing Application-Level Add-Ins

    One of the first things you will find when you create an application-level add-in is that VS carries out all the steps necessary to register the add-in with the Office application.  This means that registry entries are added so

    that when the Office application starts, it will automatically locate and load your assembly.  If you subsequently want to add or remove add-ins, then you must either navigate through Office application settings or manipulate the registry manually.

     

    The build output window briefly appears and displays the following. Note this is from a screen shot, and I was unable to read all the contents of this.

     

    Build started: Project OutlookAddIn1, Configuration: Debug Any CPU c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /warn:4 /define: DEBUG;TRACE /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Accessibility.dll /reference:"C:\Program Files\Microsoft Visual Studio 9

     

    After that Visual Studio 2008 abruptly closes.  No error message or warning appears, and the "Report problem to Microsoft" dialog does not appear.

     

    This problem also occurs if VB.Net is selected in Step 3.  And it occurs if  Outlook 2007 is opened before opening VS 2008.

     

    Some relevant project properties are below (Project > OutlookAddIn1 Properties).  If you need something else from this let me know and I can respond.

    • Target Framework: .NET Framework 3.5
    • Build Config: Active (Debug)
    • Platform: Active (Any CPU)
    • Define DEBUG Constant: Checked
    • Define TRACE Constant: Checked
    • Warning Level: 4
    • Treat warnings as errors: None
    • Output Path: bin\Debug\
    • Generate serialization assembly: Auto

    Perhaps there is something else I need to install in VS, like a patch or plug in.

     

    At the Outlook Programming Forms messageboard (also at Microsoft), Ken Slovak suggested that I perform a VS detect and repair.  Right now I'm in the process of downloading the .iso file again to do just this.  Additionally, he did not experience this problem when he executed the steps indicated above.

     

    Once the .iso is downloaded I'll try the repair again.

     

    P.S. The original problem was posted at http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.outlook.program_forms&cat=en_US_c8f74307-7854-417a-8dcd-897dda2e2446&lang=en&cr=US, where it was suggested that I post this in a more appropriate area.  I hope this is more appropriate.  Thanks.

    Monday, June 09, 2008 8:49 PM

Answers

  • A Microsoft engineer worked on a support incident regarding this issue.  As a result we have a work-around.

     

    Symptom:

    Visual Studio 2008 crashed after building an Outlook 2007 add-in project. This occurs after PowerCommands is installed. Uninstalling PowerCommands makes the issue go away.

     

     

    Root Cause:

    This is not a PowerCommands issue but rather a problem with the CLR itself where this problem manifests if assemblies are loaded in a certain order.  Installing PowerCommands and then creating a new Outlook 2007 project causes assemblies to get loaded in a way that this problem surfaces.

     

    Looking at the source code for PowerCommands, we see a Reference to System.Core.dll.  Attaching a debugger to the VS2008 IDE, we see the following being logged just before the crash:

     

    CLR: (C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Tools.Office.Runtime.v9.0\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll) Rejecting native image because dependency C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll is not native

     

    This is supposed to be fixed for the next version of the CLR.

     

     

    Workaround:

    Delete the native image generated for VSTO.  To do this, open a command prompt, navigate to the directory below, and enter the text indicated below in that directory to initiate the deletion.  This removes the Native Image Cache of the VSTO DLL.  It does not delete the VSTO DLL.

     

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>ngen /delete Microsoft.VisualStudio.Tools.Office.Runtime.v9.0

     

    The main copy of the VSTO DLL will remain untouched, so no functionality is lost, there may be a small performance penalty.  Neither the engineer nor I noticed a performance hit.

     

    To re-install the VSTO DLL  into the cache, run the NGEN command on the DLL. For example, here is the command to re-install.  Note, you need to be in the same folder as the DLL.

     

    ngen  Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll

     

     

    Two Known Fixes:

    So if you are experiencing this issue, there are basically 2 ways to handle it at this time:

    1. Uninstall PowerCommands.

    - OR -

    2. Remove the native image cache of the VSTO DLL (per the workaround instructions).

     

    Again, this should be fixed in the next version of the CLR.

    Monday, June 16, 2008 12:57 PM

All replies

  • Hi Ken

     

    I'm as much in the dark as you and Ken, but a couple of other trouble-shooting steps come to mind besides Repairing Visual Studio:

     

    1. does the same problem occur if you try to create an Add-in for Excel or Word (or any other Office app)? That should tell us whether the problem is with Outlook or not.

     

    2. If other application Add-ins do not cause VS to crash, try repairing Outlook, or uninstalling/reinstalling Office

     

    Tuesday, June 10, 2008 8:13 AM
  • Cindy,

    That's a good idea.  I'll try those steps.  This morning while running the repair I was reading the article below.

    http://msdn.microsoft.com/en-us/library/cc136646.aspx

     

    In the "Creating the Code Access Security Policies" section of that article it displays a configuration tree as follows (this is abbreviated).

    + User

    -- + Code Groups

    ----- + VSTOProjects

     

    My PC has User and Code Groups, but there is no VSTOProjects node.  Of course I just checked this right after the VS 2008 repair ran.  So that may have been wiped out.

     

    There was also a note in that section about the .NET Framework 2.0 Management Console Snap-In.  I think after rebooting I'm going to install that as well.

     

    This is my #1 priority right now.  I will continue to post my progress and the eventual solution for the benefit of others who hit this thread.  Thanks for your help Cindy.

     

    Ken

    Tuesday, June 10, 2008 1:13 PM
  •  Ken574961 wrote:

    In the "Creating the Code Access Security Policies" section of that article it displays a configuration tree as follows (this is abbreviated).

    + User

    -- + Code Groups

    ----- + VSTOProjects

     

    My PC has User and Code Groups, but there is no VSTOProjects node.  Of course I just checked this right after the VS 2008 repair ran.  So that may have been wiped out.

     

    Mmmm. On various machines I've seen both (with and without VSTOProjects). FWIW I doubt that's part of the problem you're struggling with (the crash).

     

    Good luck tracking this down! And we'll be looking forward to any resolution you can find. (I also hope that someone from the VSTO team jumps in here if they have any ideas!)
    Tuesday, June 10, 2008 1:35 PM
  • Cindy,
    Thanks again for the suggestions.  When the repair completed I rebooted, then tried creating 2007 Outlook, Excel, and Word add-ins.  The Excel and Word builds succeeded.  The Outlook build failed as per the first post -- the Visual Studio IDE simply closed unexpectedly.

     

    Also out of curiosity I checked the 2.0 Configuration console.  The VSTOProgram nodes did not appear.

     

    So I downloaded and installed the .NET Framework 2.0 SDK at :
    http://www.microsoft.com/downloads/details.aspx?FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec&displaylang=en

     

    After a shut-down, power off, reboot, I  launched Visual Studio 2008, created a new Outlook Add-In, and built.  Same problem.

     

    I'll try an Outlook/Office repair next.  Cross your fingers!


     

     

    Tuesday, June 10, 2008 2:08 PM
  • Cindy,

    Repairing Office Ultimate 2007 did not fix the problem.  As before, I rebooted, etc.

     

    After reading the article below, I thought to edit the "Start external program" settings in the project properties tab.  I pointed that setting to C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE, but that also had no impact on my problem.

    http://msdn.microsoft.com/en-us/library/bb226713.aspx

     

    That's as much stabbing in the dark as I care to do.  At this point I'm opening a support incident ticket with Microsoft.  When we determine the resolution I'll post it here.

     

    Ken

     

     

    Tuesday, June 10, 2008 3:06 PM
  • I've opened a support ticket with Microsoft.  In the meantime, I found this in the Application Event Log.

     

    .NET Runtime version 2.0.50727.1433 - Fatal Execution Engine Error (79FEC5F0) (80131506)


    Google returned the following for this:

    http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=330302

    http://forums.msdn.microsoft.com/en-US/vssetup/thread/cb73c8d6-077f-4220-aaf8-463039ee1d5f

     

    Those and some other links point to Power Commands.  I have Power Commands for Visual Studio 2008 installed.  For the most part I just use that to clean up my application list, so I'm going to uninstall that.  Maybe this will resolve the problem.
    Tuesday, June 10, 2008 5:52 PM
  • Uninstalling Power Commands corrected the problem.

     

    Here are steps to replicate the problem with Power Commands from the system setup indicated at the top of this thread.

    1.     Install Visual Studio 2008 Power Commands.

    2.     Open Visual Studio 2008

    3.     Select File > New Project > Visual C# > Office > 2007 > Outlook 2007 Add-In.

    4.     Choose the default name and then OK.

    5.     Select Build > Build OutlookAddIn1.

     

    The Output dialog will open, display a line, and then Visual Studio will abruptly close.

     

    6.     Now close Visual Studio

    7.     Uninstall Power Commands

    8.     Open Visual Studio

    9.     Follow steps 2 through 5.

     

    The Outlook Add-In project will build successfully.

     

    Since I was able to replicate this a couple of times, I’m confident that this problem is directly related to Visual Studio 2008 Power Commands. 

     

    Tuesday, June 10, 2008 6:21 PM
  • A Microsoft engineer worked on a support incident regarding this issue.  As a result we have a work-around.

     

    Symptom:

    Visual Studio 2008 crashed after building an Outlook 2007 add-in project. This occurs after PowerCommands is installed. Uninstalling PowerCommands makes the issue go away.

     

     

    Root Cause:

    This is not a PowerCommands issue but rather a problem with the CLR itself where this problem manifests if assemblies are loaded in a certain order.  Installing PowerCommands and then creating a new Outlook 2007 project causes assemblies to get loaded in a way that this problem surfaces.

     

    Looking at the source code for PowerCommands, we see a Reference to System.Core.dll.  Attaching a debugger to the VS2008 IDE, we see the following being logged just before the crash:

     

    CLR: (C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Tools.Office.Runtime.v9.0\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll) Rejecting native image because dependency C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll is not native

     

    This is supposed to be fixed for the next version of the CLR.

     

     

    Workaround:

    Delete the native image generated for VSTO.  To do this, open a command prompt, navigate to the directory below, and enter the text indicated below in that directory to initiate the deletion.  This removes the Native Image Cache of the VSTO DLL.  It does not delete the VSTO DLL.

     

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>ngen /delete Microsoft.VisualStudio.Tools.Office.Runtime.v9.0

     

    The main copy of the VSTO DLL will remain untouched, so no functionality is lost, there may be a small performance penalty.  Neither the engineer nor I noticed a performance hit.

     

    To re-install the VSTO DLL  into the cache, run the NGEN command on the DLL. For example, here is the command to re-install.  Note, you need to be in the same folder as the DLL.

     

    ngen  Microsoft.VisualStudio.Tools.Office.Runtime.v9.0.dll

     

     

    Two Known Fixes:

    So if you are experiencing this issue, there are basically 2 ways to handle it at this time:

    1. Uninstall PowerCommands.

    - OR -

    2. Remove the native image cache of the VSTO DLL (per the workaround instructions).

     

    Again, this should be fixed in the next version of the CLR.

    Monday, June 16, 2008 12:57 PM
  •  I was struggling with the same problem that Ken explained in his postings. I am currently trying to repair visual studio 2008 in order to fix it. I only have the problem with Outlook Add-in. Excell worked OK.

    One other thing that is happening is that my Outlook Add-in project sometimes works for some reason. For example I tried to repair VS 2008 yesterday but I never finished the repair, so the changes were rolled back. I was able to build my Outlook Add-in project right after this. This morning however I have the same problem like  yesterday.

    The other surprising thing was that the project was working fine for about a month before it started acting that way. I haven't installed anything to VS 2008 and my last .NET framework update was dated in mid-September. I have built the project many times since then.

    Finally, I don't have PowerCommands installed....HELP!

    P.S. My VS 2008 finished repair, and the problem is still there....
    Thursday, October 23, 2008 12:58 PM
  • I am still trying to resolve this situation also. I also dont have PowerCommands installed, I have just removed the native VASTO cache (as stated from Microsoft Eng above) and still have the same issue.

    has anyone resolved this yet?

    Friday, November 07, 2008 9:13 AM
  • KenPalmer said:

    Again, this should be fixed in the next version of the CLR.




    Will this fix be part of .net 3.5 SP1 GDR 1?
    Kris
    Tuesday, November 18, 2008 3:32 AM
  • Alternate workaround:

    I received the following message when attached to devenv.exe via WinDbg

    CLR:(C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll) Rejecting native image because dependency C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll is not native

    Running the following command fixed my problem:

    > ngen /delete System.Web.Extensions

    Tuesday, October 05, 2010 7:56 PM