[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Help! - The callee is not available and disappeared Error Message

JerryWEC

6/13/2007 6:13:00 PM

ATTN: COM Experts

I have been getting this error message and have post a few times but still
don't have any answers and I can't find any on the www.

*** Message:
The callee (server [not server application]) is not available and
disappeared; all connections are invalid. The call may have executed.
(Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED))

Note: This appears to happen when raising an event from VB.net 2005 object
to a COM (VB6) client application.

Please help me understand this cause and solve it!

TIA! JerryM


5 Answers

Ben Voigt [C++ MVP]

6/14/2007 4:45:00 AM

0


"JerryWEC" <JerryWEC@newsgroups.nospam> wrote in message
news:eIo5lZerHHA.884@TK2MSFTNGP02.phx.gbl...
> ATTN: COM Experts
>
> I have been getting this error message and have post a few times but still
> don't have any answers and I can't find any on the www.
>
> *** Message:
> The callee (server [not server application]) is not available and
> disappeared; all connections are invalid. The call may have executed.
> (Exception from HRESULT: 0x80010007 (RPC_E_SERVER_DIED))
>
> Note: This appears to happen when raising an event from VB.net 2005 object
> to a COM (VB6) client application.

When raising events, the client and server switch roles. The event source
is the client of the event sink.

When your subscribed object is destroyed, it should unsubscribe itself from
any and all events. In-process, the event subscription would hold a
ref-count that should be enough to keep the sink alive. Out-of-process, it
is possible for the user to exit the app overriding the ref-count.

>
> Please help me understand this cause and solve it!
>
> TIA! JerryM
>

JerryWEC

6/14/2007 3:21:00 PM

0

Ben, thanks for responding!!

A B
C

_____VB6___ _________________same dll
assembly_______________

************ ****************
******************
* VB6 Client * -----> * .net Wrapper * ---------> * .net
class with main *
* App * * object to expose *
* code. *
************ * to COM VB *
******************
***************

************ ********************
********************
* * * Event from main code *
* <- Event Raised here *
* * * rcvd event and *
* *
* * * reraises another event *
* *
* * * to VB6 app and *
* *
* * * At this point the error *
* *
* * * occurs goes to a error *
* *
* * * catch block. *
* *
************ ********************
*********************

I don't understand how switching roles occurs. I am only sending events
from one .net wrapper class to the VB6 application.
My VB6 application contains an instantance of the .net object (dll) and is
receiving events from the object to VB6. As far as
I know I'm not destorying any of my objects. My main object in VB6 is
created and I have a global variable holding it until
the application ends. This is an RPC error and I'm not doing anything with
the object like setting it to Nothing in VB. I am settting another object
to it like Set WM = WMGirth then maybe later Set WM = WMSeal. WMGirth and
WMSeal are my main objects in
VB6 but they are the objects from may .net assembly that are exposed to COM
using COM InterOP attributes. The objects
in VB6 are declared using With Events. I have other events that are being
raised with no issues. Originally the event seem to work
fine using buttons. But now I'm trying to system testing using Timers and
PLC interfaces that may be using cpu time and interrupts, etc...
Now I'm getting the error message in debug mode and when not in debug
(attached) events seem to take a long time.

This happens right at the point I'm raising the event to COM from my .net
wrapper class that has the COM attributes.

I'm using traditional good programming techiques in VB6 and should be doing
what I need to on the .net side. I just don't understand
how you raise an event from .net to COM and it blows up???

One other thing the point where I raise the event in my main code is in an
event handler from a TCP/IP communication object (.net). When this error
happens I handle the error to record it and then the original event handler
is called again.

I'm sorry I'm really lost. The VB6 client application is creating these
WMGrith and WMSeal object using early binding and I'm not destorying them
until the end. I believe the .net object is running in-process but I'm not
sure. When you embed a .net object in VB6 does it not run in-process?

JerryM


Ben Voigt [C++ MVP]

6/15/2007 3:04:00 AM

0


"JerryWEC" <JerryWEC@newsgroups.nospam> wrote in message
news:ePU0XeprHHA.1864@TK2MSFTNGP04.phx.gbl...
> Ben, thanks for responding!!
>
> A B C
>
> _____VB6___ _________________same dll
> assembly_______________
>
> ************ **************** ******************
> * VB6 Client * -----> * .net Wrapper * ---------> * .net
> class with main *
> * App * * object to expose * * code.
> *
> ************ * to COM VB * ******************
> ***************
>
> ************ ******************** ********************
> * * * Event from main code * * <-
> Event Raised here *
> * * * rcvd event and * *
> *
> * * * reraises another event * *
> *
> * * * to VB6 app and * *
> *
> * * * At this point the error * *
> *
> * * * occurs goes to a error * *
> *
> * * * catch block. * *
> *
> ************ ******************** *********************
>
> I don't understand how switching roles occurs. I am only sending events
> from one .net wrapper class to the VB6 application.
> My VB6 application contains an instantance of the .net object (dll) and is

Ok, that's reasonable.

> receiving events from the object to VB6. As far as

Not really. You don't receive events. When you use a component from VB, a
control or such, you have an interface pointer to that object, through which
you can call its methods and properties. A component that has events
declares a second interface but does not implement it. Instead, the user
(in your case VB) adds that interface to one of its objects, called an event
sink, and gives the interface pointer to the component, the event source.

Now the component holds the pointer to the user. Thus the normal roles are
reversed.

> I know I'm not destorying any of my objects. My main object in VB6 is
> created and I have a global variable holding it until
> the application ends. This is an RPC error and I'm not doing anything
> with the object like setting it to Nothing in VB. I am settting another
> object to it like Set WM = WMGirth then maybe later Set WM = WMSeal.
> WMGirth and WMSeal are my main objects in

Both of these have a long lifetime that you know has not ended? Have you
put logging code in the destructor (I think it's called Terminate in VB)?

> VB6 but they are the objects from may .net assembly that are exposed to
> COM using COM InterOP attributes. The objects
> in VB6 are declared using With Events. I have other events that are being
> raised with no issues. Originally the event seem to work
> fine using buttons. But now I'm trying to system testing using Timers and
> PLC interfaces that may be using cpu time and interrupts, etc...

That suggests a threading problem. Perhaps your .NET component and VB
aren't agreed on whether the objects are single-threaded,
apartment-threaded, or free-threaded? Try using Control.Invoke in .NET to
raise the message.

> Now I'm getting the error message in debug mode and when not in debug
> (attached) events seem to take a long time.
>
> This happens right at the point I'm raising the event to COM from my .net
> wrapper class that has the COM attributes.
>
> I'm using traditional good programming techiques in VB6 and should be
> doing what I need to on the .net side. I just don't understand
> how you raise an event from .net to COM and it blows up???
>
> One other thing the point where I raise the event in my main code is in an
> event handler from a TCP/IP communication object (.net). When this error
> happens I handle the error to record it and then the original event
> handler is called again.
>
> I'm sorry I'm really lost. The VB6 client application is creating these
> WMGrith and WMSeal object using early binding and I'm not destorying them

How about the object declaring WithEvents references? Is that a code module
or a class module? Does an instance of the VB class possibly get destroyed.
It is decidedly *not* the .NET instances that are dying, it is the VB object
that is inaccessible when the .NET code tries to call the event handlers.

> until the end. I believe the .net object is running in-process but I'm
> not sure. When you embed a .net object in VB6 does it not run in-process?
>
> JerryM
>

JerryWEC

6/17/2007 9:49:00 PM

0

Ok, I'm providing more info:

Under Debug|Exceptions, I de-selected the System.Runtime.InteropServices' User-unhandled checkbox (unchecked). This did not seem to help.
Under Tools|Options|Debugging|General, I have "Enable Just My Code (Managed only) checked.

The IDE has put some Debugger attributes in some of the resource files but nothing looks wrong here.

One Question:

I'm wondering if the are some threading or appartment threading attribute(s) I need to add to my .net code to interoperate with the VB6 COM client application. (???)

TIA! JerryM

wawang

6/18/2007 12:54:00 PM

0

Hi Jerry,

What Ben suggested is one possible cause that the VB6 object which is
handling the event raised from .NET side might be closed before notifying
the .NET side correctly, when the .NET side raises the event again, it
might cause this exception. However, there may have other possiblities.
Without live debugging and have full access to the source code, it's hard
to tell such issue.

If you don't want to contact our Customer Support and Service (which
provides dump analysis or live debugging), you will need to find a way to
reproduce the issue and post the reproducible project here for further
troubleshooting.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.