Bad interaction between COM Interop and Remoted service - HELP!!!!
Hello all,
I hope that I am not the first to experience this issue (I
will be quite surprised if I am), however it is killing my
development schedule so I am here begging for help.
Here is what is happening:
I have been tasked to write a Com Callable Wrapper
assembly that will permit legacy VB 6.0 COM Client code to
utilize some of the functionality in our .Net managed
code. No big deal - all was working fine - VB 6 was
happily accessing the .Net code via an assembly I called
CCWInterface.
Then cam a new requirement - the VB 6 apps would have to
log in to our system (or at least the CCWInterface
assembly would when accessed). We have a UserSecurity
CCWInterface assembly used to call UserSecurity. Here
comes the hitch - The UserSecurityManager
(IAuthenticationManager) is a Remoted service.
Using code that works flawlessly in a .Net application or
even a simple console app test case produces an exception
when called from within the CCW assembly.
Here is the exception and the stack trace:
Exception caught: Return argument has an invalid type.
Exception type is: System.InvalidCastException
stack trace:
at
System.Runtime.Remoting.Proxies.RealProxy.Validate ReturnArg
(Object arg, Type paramType)
at
System.Runtime.Remoting.Proxies.RealProxy.Propagat eOutParam
eters(IMessage msg, Object[] outArgs, Object returnValue)
at
System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessa
ge(IMessage reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke
(MessageData& msgData, Int32 type)
at
ServiceLink.Cactis.Business.UserSecurity.IUSecServ er.GetAut
henticationManager()
at
ServiceLink.Cactis.Business.UserSecurity.Client.US ecClient.
GetAuthenticator()
at
ServiceLink.Cactis.Business.OrderEntry.CCWInterfac e.CCWInte
rface.set_UserName(String value) in
c:\servicelink\cactis\business\orderentry\ccwinter face\ccwi
nterface.cs:line 538
The line of code that produces it is:
IAuthenticationManager iauthen = client.GetAuthenticator();
This code accesses the Remoted SingleCall object to get
the manager for logging in.
It appears that the return type is causing a problem.
The full scenario is:
the VB 6 app creates an instance of the CCWInterface object
It sets the UserName Property
the CCWInterface assembly attempts the above call to the
Remoted service
The exception happens.
Can anyone help me with this? Has anyone experienced a
similar (or even the same type) of problem and knows of a
work around?
Thanks,
Gary R. Graham
|