Writing several programs in C# that require using a COM server. I can interop no problem. The challenge lies in the fact that each time I need to use the COM server, I end up having to log into a "session". That process can take 30 seconds or more. This wait is unacceptable for our situation.
The initial solution I have come up with is to create a C# "server" application that logs in on startup and makes itself available via TCP/Binary remoting for cross process calls. It logs into a session and waits for calls to deliver a MarshalByReference instance of my COM "session". I have already fought with and resolved my server-side instance lifetime and deserialization issues. In fact, everything works great, for the most part.
When I need to use the marshalled "Session" for methods that return COM objects or primatives (i.e. int, string) and contain primatives as parameters, everything works great. However, when I need to access a method that takes a locally created COM object instance as a parameter, I receive the following error:
I have the feeling I need to do something to allow passing a COM interop instance by value, but I don't know what.
Anybody have any ideas? Thanks in advance!
B.J.
The initial solution I have come up with is to create a C# "server" application that logs in on startup and makes itself available via TCP/Binary remoting for cross process calls. It logs into a session and waits for calls to deliver a MarshalByReference instance of my COM "session". I have already fought with and resolved my server-side instance lifetime and deserialization issues. In fact, everything works great, for the most part.
When I need to use the marshalled "Session" for methods that return COM objects or primatives (i.e. int, string) and contain primatives as parameters, everything works great. However, when I need to access a method that takes a locally created COM object instance as a parameter, I receive the following error:
Code:
The argument type System.MarshalByRefObject cannot be converted into parameter type <my com type here>
I have the feeling I need to do something to allow passing a COM interop instance by value, but I don't know what.
Anybody have any ideas? Thanks in advance!
B.J.