Getting an object cast exception - on just one machine

D

David Thielen

Hi;

First off this is a .NET/C#/IDTExtensibility2 application.

The following code works fine on two computers:

public void OnConnection(object application, ext_ConnectMode
connectMode, object addInInst, ref Array custom)
{
applicationObject = application;
}

public void OnStartupComplete(ref Array custom)
{
ApplicationClass app = applicationObject as ApplicationClass;
app.ApplicationEvents3_Event_DocumentOpen += new
ApplicationEvents3_DocumentOpenEventHandler(Event_DocumentOpen);
}

But on a third computer, while app comes back as a System.__ComObject,
the attempt to get the document open event throws a "Object reference
not set to an instance of an object" exception.

This third computer has Office 2003 installed on it. However, the
other 2 computers have VisualStudio installed and this one does not -
if that makes any difference.

Any ideas?

thanks - dave
 
D

David Thielen

Hi;

First off this is a .NET/C#/IDTExtensibility2 application.

The following code works fine on two computers:

public void OnConnection(object application, ext_ConnectMode
connectMode, object addInInst, ref Array custom)
{
applicationObject = application;
}

public void OnStartupComplete(ref Array custom)
{
ApplicationClass app = applicationObject as ApplicationClass;
app.ApplicationEvents3_Event_DocumentOpen += new
ApplicationEvents3_DocumentOpenEventHandler(Event_DocumentOpen);
}

But on a third computer, while app comes back as a System.__ComObject,
the attempt to get the document open event throws a "Object reference
not set to an instance of an object" exception.

This third computer has Office 2003 installed on it. However, the
other 2 computers have VisualStudio installed and this one does not -
if that makes any difference.

Any ideas?

thanks - dave
 
M

Mike Walker

Have you installed the Extensibility.dll as this is required for talking to
the COM Addin interfaces, this is in the vs.net common folder public
assemblies and maybe for testing purposes able to be copied into the same
directory as the assembly you are running.

Rgds

Mike Walker
(Reply via NG)
 

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