Why COM add-in won't run without notice nor error message?

D

Dave [MSFT]

Hi Ced,

Your application is definately managed. You are using what is called a
shared COM Addin. These are different from VSTO in that they use the
standard CLR COM Interop layer.

Here is what I say you should try next:

1. Confirm that the .NET Framework is installed on the client that you are
having a problem on. If you have not installed the .NET Framework,
mscoree.dll will not be on the machine.
2. Confirm that a simple vbscript can create your .NET object. Create a
vbscript with the following code:
<code >
Option Explicit
Dim objAddin
const PROGID = "Quinoa.Connect" ' I assume this is your ProgId based on the
ProcMon

On Error Resume Next

Set objAddin = Nothing

Set objAddin = CreateObject(PROGID)

If Not objAddin Is Nothing Then
WScript.Echo "The object has been created!"
Set objAddin = Nothing
Else
WScript.Echo "The object has NOT been created!"
End If
</code >
Then run the script, by either double-clicking the vbscript file or using
the following command at the command prompt : cscript <scriptname>.vbs. If
the code works you know that the object can be created via COM. If it
doesn't then you know it's a COM or CLR issue.

3. If the script above works, and you can create the COM object then I would
look at your start up code. Often times we see developers who have start up
code that makes assumptions about the state of Outlook or the state of the
OS. When those assumptions are wrong the Addin exits without doing any
processing and the developer assumes that his Addin wasn't loaded. One thing
that may be helpful is adding more diagnostic information in the form of
either message boxes (crud I know) or a log file. Be careful when creating a
log file because if you attempt to write to a location that you don't have
access to this will cause additional problems and more red herrings to run
down.
This is a continuation of the thread here:
http://forums.community.microsoft.c...s/thread/13412bc1-f7a6-4544-b504-7a3e1652c8a4
 
C

Cedric

Hi Dave,

I can't give you yet all the feedbacks (see below), but this is a quick
reply just to confirm I saw that the topic had moved here.

1. The .Net framework is installed on my PC. I think version 3.5, I keep it
up to date.

2. I never used VB script, so it'll take a few time before I answer your
questions.

3. Good to know. I tried to make things as clean as possible, using the
template code that searches for explorers and inspectors, and acting based on
this. But I'll doublecheck

Thanks for your help so far, I keep you posted asap.

Regards,
Cedric.
 
C

Cedric

Hi Dave,

I performed the test, and it appears that the object is not created.

you say it can be a CLR or COM issue. But I don't know how to move forward
on this. Can you please help?

Thanks!

Cedric.
 
C

Cedric

Hi Ken!

The scenario described in the page you linked isn't exactly what I'm facing :

If you go to COM Add-Ins dialog, it shows the add-in as unchecked, and you
see an error “Not loaded. A runtime error occurred during the loading of the
COM Add-In†when you select the add-in entry.
=> This error message didn't appear. The comm add-in is simply unchecked.

If you check for the LoadBehavior for the Add-In in registry, it has changed
from 3 to 2.
=> No, it remains set to 3.

Nevertheless, I wonder about the following:
- I use VS2008, maybe it uses .Net Framework 3.5?
- I register my COM add in with the .Net Framework 2.0 as follows:
C:\Windows\Microsoft.Net\Framework\v2.0.50727\RegAsm.exe ".\Quinoa.dll"
/codebase
Could this be the source of the problem? Again, I don't think so as my home
PC has the add-in installed the same way and it works...

Thanks for your help.

Cedric.
 
K

Ken Slovak - [MVP - Outlook]

Hi,

If the same addin is running on your home machine then your registration
process should be OK, as long as the Framework version is there. You can set
a VS 2008 addin to use Framework 2.0, and if that's what you have on your
home machine then that should be OK.

My guess is that you don't have a load condition or prerequisite installed
where it's not working. You can check each dependency to see if it's there,
but I'd be inclined to implement the Fusion logging and see what that shows.
That's the most likely thing to tell you what's going on and where your
addin load is failing.
 
C

Cedric

Hi Ken!

So now, the script given by Dave tells me the object is created. I didn't
change anything, except maybe simply restarting my PC. And I didn't dream the
las ttime, as I remember that the upper case "NOT" in the message box made me
smile.

Anyway, I attempted to strike on both side : i modified my code to display a
message box before doing anything, and I checked the fusion log. In details:

* Though I don't use VSTO, my work is based on a VSTO template. Meaning I
have the IDTExtensibility implemented in the connect.designer.vb file, and
the connect method in the Connect class. So I tried putting a Msgbox in both
the connect method and the previously unchanged OnConnection method. None of
them appeared. Strange...

* The fusion log is also quite amazing : when I load the COM object using
Dave's script, I have the message box telling me the object is loaded, and I
can see 4 entries in the fusion log. Now, when I launch Outlook (with load
behavior = 3), or when I go to the com mgt dialog and start my add-in,
nothing appears in the fusion log, as if there wasn't any attempt to load the
COM object. Let me mention that I tool care of logging all binds.

My conclusion is that my object is loaded by Dave's script, but for some
reason, not by Outlook. And this is why my message boxes don't appear.
One way to doublecheck this would be to add a few lines of code to Dave's
script to simulate the call made by outlook, I guess by retreiving an
existing instance of outlook and calling the OnConnection... but as I'm a
very absolute beginner newbie apprentice to VBScript, I don't know how to
achieve this.

Then I'd like to investigate further on how Outlook can reject a com add-in
like that.

One difference with my home PC is the Linked in COM add-in which seems to be
non-managed (doesn't call mscoee-thingamabob.dll), and is installed on my
work PC where my add-in fails. In case it could interfere, i tried to uncheck
it in the COM dialog, and then uninstalling it, but none of these actions
changed anything.

Any help much appreciated!
Thanks in advance.

Cedric.
 
C

Cedric

Hi Ken!

So now, the script given by Dave tells me the object is created. I didn't
change anything, except maybe simply restarting my PC. And I didn't dream the
las ttime, as I remember that the upper case "NOT" in the message box made me
smile.

Anyway, I attempted to strike on both side : i modified my code to display a
message box before doing anything, and I checked the fusion log. In details:

* Though I don't use VSTO, my work is based on a VSTO template. Meaning I
have the IDTExtensibility implemented in the connect.designer.vb file, and
the connect method in the Connect class. So I tried putting a Msgbox in both
the connect method and the previously unchanged OnConnection method. None of
them appeared. Strange...

* The fusion log is also quite amazing : when I load the COM object using
Dave's script, I have the message box telling me the object is loaded, and I
can see 4 entries in the fusion log. Now, when I launch Outlook (with load
behavior = 3), or when I go to the com mgt dialog and start my add-in,
nothing appears in the fusion log, as if there wasn't any attempt to load the
COM object. Let me mention that I tool care of logging all binds.

My conclusion is that my object is loaded by Dave's script, but for some
reason, not by Outlook. And this is why my message boxes don't appear.
One way to doublecheck this would be to add a few lines of code to Dave's
script to simulate the call made by outlook, I guess by retreiving an
existing instance of outlook and calling the OnConnection... but as I'm a
very absolute beginner newbie apprentice to VBScript, I don't know how to
achieve this.

Then I'd like to investigate further on how Outlook can reject a com add-in
like that.

One difference with my home PC is the Linked in COM add-in which seems to be
non-managed (doesn't call mscoee-thingamabob.dll), and is installed on my
work PC where my add-in fails. In case it could interfere, i tried to uncheck
it in the COM dialog, and then uninstalling it, but none of these actions
changed anything.

Any help much appreciated!
Thanks in advance.

Cedric.
 
D

Dave Vespa [MSFT]

Hi Cedric,

Check to see if your COM Addin is in the disabled items list.

In Outlook 2003:

Help > About Microsoft Outlook > Disabled Items

In Outlook 2007:

Help > Disabled Items

If it is, or if there are others there enable them.

One of the problems with Shared Com Addins is that they all share the same
underlying DLL (mscoree.dll) Therefore if someone else's Shared COM Addin
gets disabled that could have an affect on yours because they use the same
underlying DLL.

I have in the past tried to alter my script to call directly into the
_IDTExtensibility2 methods to no avail. I always run into type mismatch
errrors and I haven't had the persistence to debug why.

Dave
 
K

Ken Slovak - [MVP - Outlook]

To add to what Dave mentioned about disabled addins, one thing you should do
with a shared managed code addin is to provide it with its own AppDomain by
shimming the addin. Otherwise any managed code addins that aren't shimmed
share the same AppDomain and if one crashes or fires an unhandled exception
the chances are that all of them will be disabled by Outlook. Shimming helps
to prevent that.

There's a COM Shim Wizard that you should download that will provide
shimming for a managed code addin. You can download the latest version of
the wizard (2.3.1) from
http://www.microsoft.com/downloads/...08-5008-4bb6-aa85-93c1d902470e&DisplayLang=en
 
C

Cedric

As simple as that...

Thank you Dave and Ken for your help!

You were right, Dave, the add-in was disabled in the location you mentioned.
I wasn't even aware of such a thing! I simple removed my add-in entry and
restarted Outlook and immediately saw my message boxes and everything
working. Yeepee!!!

Thank you Ken for the information about shimmed add-ins. I'll look after
this straight away as it could be a source of problems.

I'm really happy. Many thanks to both of you for your valuable help and
time! Hope to share my add-in pretty soon with you if you find it useful!

Cedric.
 

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