HighTechTalks DotNet Forums  

Knowing when COM interop is possible

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss Knowing when COM interop is possible in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
BGU
 
Posts: n/a

Default Knowing when COM interop is possible - 04-11-2005 , 02:38 PM






Hello, We have a CRM system here called Pivotal eRelationship R99. I am
writing a batch upload service to populate the CRM with data from various
sources. Pivotal shipped a COM component in 1999 to assist with this kind
of activity. It is an ActiveX 1.0 control module called RelOcx. I am
trying to call it from Visual J# 2003 using COM interop.

I've had good luck with COM interop in the past, but not in this case.
Although I can instantiate a RelOcx class in my program, as soon as I call
any of the object's methods, an unhandled exception is thrown. The methods
I have tried calling all perform quite basic operations, so nothing
unexpected *should* be taking place here. A stack trace with a source
excerpt is below.

Here is my question: it seems the use of older components from .NET is
possible in some instances but not in others. How can the programmer know
when COM interop is possible?

The closest answer I can find lives at
http://msdn.microsoft.com/library/de...tframework.asp.
The editors write, "An ideal [old] component has a primary interop assembly
and conforms tightly to the programming standards imposed by COM." I'm not
sure how I would know whether that is the case here.

Thanks,
BGU

************

Server Error in '/Exp7' Application.


Catastrophic failure
Description: An unhandled exception occurred during the execution of the
current
web request. Please review the stack trace for more information about the
error
and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Catastrophic
failure

Source Error:


Line 22: {
Line 23: RelationshipCacheClass c = new RelationshipCacheClass() ;
Line 24: c.set_DisplayUI( true ) ;
Line 25: Label1.set_Text( c.getClass().toString() ) ;

Source File: c:\inetpub\wwwroot\Exp7\WebForm1.aspx.jsl Line: 24

Stack Trace:


[COMException (0x8000ffff): Catastrophic failure]
System.RuntimeType.ForwardCallToInvokeMember(Strin g memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData) +463
RELOCXLib.RelationshipCacheClass.set_DisplayUI(Boo lean ) +0
Exp7.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\Exp7\WebForm1.aspx.jsl:24
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750




Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032



Reply With Quote
  #2  
Old   
Ted
 
Posts: n/a

Default Re: Knowing when COM interop is possible - 04-13-2005 , 09:28 PM






BGU,

I have the same problem. What I had to do was do a sleep for enough to
ensure that the assembly was loaded. If I try to access it before it is
loaded, I get an exception.

I am also looking for a programmitcal way to check if the assembly is loaded
before I use it.

Ted


"BGU" <pri (AT) va (DOT) te> wrote

Quote:
Hello, We have a CRM system here called Pivotal eRelationship R99. I
am writing a batch upload service to populate the CRM with data from
various sources. Pivotal shipped a COM component in 1999 to assist with
this kind of activity. It is an ActiveX 1.0 control module called RelOcx.
I am trying to call it from Visual J# 2003 using COM interop.

I've had good luck with COM interop in the past, but not in this case.
Although I can instantiate a RelOcx class in my program, as soon as I call
any of the object's methods, an unhandled exception is thrown. The
methods I have tried calling all perform quite basic operations, so
nothing unexpected *should* be taking place here. A stack trace with a
source excerpt is below.

Here is my question: it seems the use of older components from .NET is
possible in some instances but not in others. How can the programmer know
when COM interop is possible?

The closest answer I can find lives at
http://msdn.microsoft.com/library/de...tframework.asp.
The editors write, "An ideal [old] component has a primary interop
assembly and conforms tightly to the programming standards imposed by
COM." I'm not sure how I would know whether that is the case here.

Thanks,
BGU

************

Server Error in '/Exp7' Application.


Catastrophic failure
Description: An unhandled exception occurred during the execution of the
current
web request. Please review the stack trace for more information about the
error
and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException:
Catastrophic
failure

Source Error:


Line 22: {
Line 23: RelationshipCacheClass c = new RelationshipCacheClass() ;
Line 24: c.set_DisplayUI( true ) ;
Line 25: Label1.set_Text( c.getClass().toString() ) ;

Source File: c:\inetpub\wwwroot\Exp7\WebForm1.aspx.jsl Line: 24

Stack Trace:


[COMException (0x8000ffff): Catastrophic failure]
System.RuntimeType.ForwardCallToInvokeMember(Strin g memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData) +463
RELOCXLib.RelationshipCacheClass.set_DisplayUI(Boo lean ) +0
Exp7.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\Exp7\WebForm1.aspx.jsl:24
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750




Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET
Version:1.1.4322.2032




Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Knowing when COM interop is possible - 11-14-2005 , 02:00 PM



Have you tried the "begininit" and "endinit" statements in the system
namespace? Make a regular MFC application, then take any ActiveX and
drop it on a form. The importer will run and create your AXabcInterop
assembly and the rest. Now look at the form designer code. It shows
you how microsoft makes sure the component is instantiated before
properties to it try to get set.

Fred

Nicolas Bourré wrote:
Quote:
Hi,
I have the same problem, but couldn't make it through. What do you exactly
mean by "do a sleep"?

Thank you


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.