Outlook crashes

J

Jon Rizzo

I have been working on an Outlook addin developed with a VSTO designer. The
application has been working great for about 5-6 months now. Unfortunately,
a problems seems to have developed some time since my last release. Now,
when I install the latest version of the application (even on my development
machine), it causes Outlook to crash. If I run the application from the VS
debugger, it works FINE. Because it never crashed while I was debugging, I
have done a considerable amount of work since the last stable version, so the
question "what changed" is difficult to answer. Quite a lot has changed.
Any suggestions about what might cause this behavior, or what I can do to
isolate it?

Jon
 
K

Ken Slovak - [MVP - Outlook]

Are you using a software control system where you can rollback changes or
check for diffs? If not and you don't have an earlier version of the source
saved away you'll just have to go over every procedure in your code.
 
J

Jon Rizzo

I found the cause, although I'm not sure why it's a problem. I had
refactored some code and moved several classes to a another project that
references the Outlook and Office type libraries. Moving these classes back
to the main VSTO-generated project made the crashes stop. I'm still not sure
why it would work in VS but not when installed, but I guess I will have to
live with it.

Jon
 
J

Jon Rizzo

Ken,

I managed to resolve the issue in Outlook 2003 by moving everything back to
1 DLL. However, the problem still exists in my Outlook 2007 project. On a
hunch, I decided to test your VSTO_VBOutlookTemplate project, and to my
surprise, I have the same problem with that project. If I run it from the
debugger, it works, but if I build the installer and install it, outlook
detects a problem and disables the addin on startup. I assume that you have
tested the setup project, so I can only assume that there must be something
different about my test computer. Any ideas?

Jon
 
K

Ken Slovak - [MVP - Outlook]

No ideas really.

I certainly did test the template projects and they build and install and
the addins run with them.

However, I did leave out some things for deployment needed for VSTO
projects. I didn't add a SetSecurity project since at the time my book was
written the SetSecurity information wasn't available for Office 2007. The
information needed for SetSecurity was noted in the book and can be found at
http://msdn.microsoft.com/en-us/library/bb332051.aspx. You need to follow
the walkthroughs step by step and completely.

The other thing I didn't do in my sample projects was to add strong naming,
something else definitely required for VSTO addins.

I just added a dummy pfx file created by VS and strong named the VSTO VB
addin. I then built the addin and setup project and ran the installer. I
opened the Framework 2.0 configuration utility and added a new entry under
My Computer\Runtime Security Policy\User\Code Groups\All_Code as VSTOVB. It
was created there as Copy of VSTOVB. I then clicked on Edit Code Group
Properties and in the Membership Condition tab I chose Strong Name. I
clicked the Import button and imported the addin dll from its installation
folder, which then showed the public key for the PFX I generated in VS. The
permission set was Full Trust.

Once that was set up I opened Outlook 2007 and the VSTO VB addin ran with no
problems.

My guess is if you do what I did the addin will work on your setup. Then for
production you will need a certificate for strong naming the addin and you
should add the SetSecurity project that can be downloaded from a link in the
article I pointed you to. Make sure to follow the exact steps in the
walkthrough for SetSecurity and that should do it.
 
J

Jon Rizzo

Thanks, that did the trick. I suspect that was the cause of my original
problem. I thought my installer was granting full trust to the entire
installation directory, but in reality, it probably wasn't.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top