Re: COM DLL works fine in C# but not when using Remoting

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: SARA (SARA_at_discussions.microsoft.com)
Date: 08/06/04


Date: Fri, 6 Aug 2004 06:25:01 -0700

Thanks for the quick response.

That is how I had it set up. I had the Session objectt declared as private.
 I had a public function called connect(). Inside the connect() function I
was calling Session.Connect(Arg). Should the Arg object also be a private
member? Currently, I am creating a local object and passing it to the
Session.Connect(Arg) function.

Here's the exact exception I am getting:

Unhandled Exception: System.Runtime.InteropServices.COMException
(0x80010105): The server threw an exception.

Server stack trace:
   at TestClientLib.ISession.Connect(Arg pConnectParam)
   at TestNameSpace.TestRemote.connect() in
c:\MyWebServices\Test.NET\TestRemote.cs:line 68
   at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase
mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)
   at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
   at TestNameSpace.TestRemote.connect() in
c:\MyWebServices\Test.NET\TestRemote.cs:line 48
   at TestNameSpace.RemoteClient.Main(String[] args) in
c:\MyWebServices\Test.NET\RemoteClient.cs:line 22

"Sunny" wrote:

> In article <F5C59F91-4C09-49A8-8FDF-7A64CA6FABE4@microsoft.com>,
> SARA@discussions.microsoft.com says...
> > Greetings All:
> >
> > I have a COM DLL that works perfectly fine in a C# program. However, if I
> > move the same code to a class that inherits from MarshalRefObj I get an
> > exception and I can not call the same function that I call correctly if I do
> > not use Remoting. The function in question is called Connect(Arg) in a class
> > called Session. I can call other functions in the Session class and teh Arg
> > class that return string args. However, the Connect(Arg) function fails and
> > throws System.Runtime.InteropServices.COMException.
> >
> > I am new to the .NET technology and I have tried searching the newsgroups
> > for this but have not found anything.
> >
> > I was curious to know what I am doing wrong.
> >
> > SARA
> >
> >
>
> Hi Sara,
>
> create the COM object as private in your MBR class. Then expose to the
> clients a wrapper methods, which in turn will call the COM object's
> methods.
>
> Sunny
>



Relevant Pages

  • Re: realtime rl v.2
    ... You have to make a choice between a Rendering Engine knowing how to render objects of different type, or each object knowing how to render itself to a surface. ... If you want to use the second, the surface should be separate from the object and can be used like Object.Render;. ... Start with (Private Properties, Public Properties, Constructors, Private/Protected Methods, Public Methods; for forms add Form Events and Control Events). ... To find it yourself, click Debug->Exceptions and then find the above exception, click the left check box and ok. ...
    (rec.games.roguelike.development)
  • RE: Biztalk 2006 Tutorial 3
    ... Exception type: ServiceCreationException ... Microsoft.BizTalk.XLANGs.BTXEngine.BTXSession._createOrRehydrateRealService(Guid& instanceId, IBTMessage currMsg) ... md, Objectargs, Object server, Int32 methodPtr, Boolean fExecuteInContext, ...
    (microsoft.public.biztalk.general)
  • Re: Help Needed: Cant Successfully Perform Server-side Redirection
    ... The only problem that I really have is session timeouts. ... situations and redirect the user to the Logon page. ... Catch e As Exception ... ThreadAbortException or mixing the HTML from two separate pages into ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Critique ThreadQueue class please
    ... intact in case I ever want to try again, but moved them to private ... Okay, since assignment op and cctor can be dropped anyway, the comment ... I never handled OOM condition in a program, but I do handle the exception ... const int NumOfQueues ...
    (comp.programming.threads)
  • Re: realtime rl v.2
    ... Separate your Objects from their rendering implementation, ... Rendering Engine knowing how to render objects of different type, ... private with the 'private' keyword. ... yourself, click Debug->Exceptions and then find the above exception, click ...
    (rec.games.roguelike.development)