DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 05 Jul 2007 22:56:31 -0000,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    unknown


TargetInvocationException and COM   
Hello,

I have created a ComVisible class in one assembly.  This class is used
to create intances of types and then return them.  For example, it
exposes a function called LoadType which takes an assembly path and
the type name, and creates an instance of the class.

When this ComVisible class is used in javascript to load an instance
of a class that is marked as COM visible in one assembly that
references another type defined in another assembly that is marked as
COM visible, the LoadType fail calls with a
TargetInvocationException.  However, if I comment out the code that
references the type defined in the latter, LoadType works fine.

In other words, class A is ComVisible and exposes a COM interface with
a method called LoadType.  This class is defined in its own assembly
X.

Class B is ComVisible and defined in its own assembly Y.

Various types such as classes and enums are defeined in another
assembly Z.

If Class B has a member of a type defined in assembly Z, and I try to
call LoadType to create an instance of class B using an instance of
class A (which is COM object) in javascript, the call fails with a
TargetInvocationException.

However, if I remove that reference to the type defined in assembly Z
and I try to call LoadType to create an instance of class B using an
instance of class A in javacript, the call succeeds and the object is
returned.

Why does this happen?

Thanks.
Date:Thu, 05 Jul 2007 22:56:31 -0000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us