N
n.vaughan
People.
I'm struggling with an issue here.
The .Net2.0 application i'm developing makes use of both the
WebBrowser control and controls hosted with this.
When the document has loaded i check the DOM through an
GetElementsByTagName( "object" ) call to get references to the objects
hosted in IE.
This provides me with access to a proxy to the hosted object which i
access as follows:
HtmlElementCollection elems =
m_browser.Document.GetElementsByTagName( "object" );
foreach ( HtmlElement elem in elems )
{
HTMLObjectElement obj = elem.DomElement as HTMLObjectElement;
( obj.@object as BaseHosted ).RegisterClient( m_handler );
}
I am able to call methods on the proxy as if it were an instance of
BaseHosted (which the hosted control derives from) however when I try
and register an interface to be called back on ( RegisterClient )
which takes an interface (of type IMapControlClient) in this case
implemented by m_handler (which derives from MarshalByRefObject) the
call fails:
System.Runtime.Remoting.RemotingException: The argument type
'System.MarshalByRefObject' cannot be converted into parameter type
'IMapControlClient'. ---> System.InvalidCastException: Object must
implement IConvertible.
Now i'm guessing that there is something in the remoting chain which
is refusing to marshal this object reference across the app domain
boundary. I'm also guessing the some sort of COM is involved along the
way.
Has anyone managed to get this to work and if so how?? If not can
anyone suggest what might be happening?
Kind regards,
Nick Vaughan.
I'm struggling with an issue here.
The .Net2.0 application i'm developing makes use of both the
WebBrowser control and controls hosted with this.
When the document has loaded i check the DOM through an
GetElementsByTagName( "object" ) call to get references to the objects
hosted in IE.
This provides me with access to a proxy to the hosted object which i
access as follows:
HtmlElementCollection elems =
m_browser.Document.GetElementsByTagName( "object" );
foreach ( HtmlElement elem in elems )
{
HTMLObjectElement obj = elem.DomElement as HTMLObjectElement;
( obj.@object as BaseHosted ).RegisterClient( m_handler );
}
I am able to call methods on the proxy as if it were an instance of
BaseHosted (which the hosted control derives from) however when I try
and register an interface to be called back on ( RegisterClient )
which takes an interface (of type IMapControlClient) in this case
implemented by m_handler (which derives from MarshalByRefObject) the
call fails:
System.Runtime.Remoting.RemotingException: The argument type
'System.MarshalByRefObject' cannot be converted into parameter type
'IMapControlClient'. ---> System.InvalidCastException: Object must
implement IConvertible.
Now i'm guessing that there is something in the remoting chain which
is refusing to marshal this object reference across the app domain
boundary. I'm also guessing the some sort of COM is involved along the
way.
Has anyone managed to get this to work and if so how?? If not can
anyone suggest what might be happening?
Kind regards,
Nick Vaughan.