Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

TargetException while raising COM event for interop

$
0
0

Hi experts,

I've one DLL loaded in two Internet Explorer Windows. While loading the first one, a singleton is created. This singleton raises COM events, which are received by JavaScript in the Internet Explorer windows. This works fine and both IE windows are getting the events. The whole scenario works on my development machine. After deploying everything to a production machine, I get a TargetException (the object does not match the target type) when raising the COM event, but only when a function in the singleton is called from the second IE window. When I call a function from singleton instance from the first IE window everything works fine and I receive the events. I am completely lost because it works on my dev machine.

My event is defined in an interface, however the delegate is created within the singleton class.

The event definition:

  [Guid("6FA477D9-85C7-4bf3-9D53-F5440AD7164F")]

  [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]

  [ComVisible(true)]

  public interface IOcsExposedEvents

  {


    void CallStatusEvent(string message);

  }

The function definition raising the event :

[Guid("3F088DF3-2C22-4b81-8D28-68547665E706"),
InterfaceType(ComInterfaceType.InterfaceIsDual),
ComVisible(true)]

public interface IOcsIntegrator

{


  int call(string sip_uri);

}


My event delegate (defined in the singleton class):

public delegate void CallStatusDelegate(string message);


public event CallStatusDelegate CallStatusEvent;

 

And finally raising the event:

public int call(string sip_uri)

{
  _callStatus = CallStatus.disconnected;

  CallStatusEvent(_callStatus.ToString());
}

 

 

Any help is really appreciated!


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>