Hi,

I have a .NET assembly which I use from unmanaged code
over COM (I use regasm to generate COM type library
from assembly).

Everything worked fine until I added application domains.

The situation is the following:

MainDomain
    MainAssembly

OtherDomain
    MainAssembly
    AdditionalAssembly

class A {

    B GetB ()  { ... }
}

class B : MarshalByRefObject {
    ...
}

Class A is instantiated in the MainDomain.

In GetB method I create an instance of B in OtherDomain
and return proxy to it in MainDomain, by method
CreateInstanceAndUnwrap.

When I call method GetB from another managed assembly,
everything is OK. However, when I call GetB from unmanaged
code through COM, it doesn't work. In debug mode, I get the error
"Corrupted stack" or something like that.

If GetB returns B object created in the MainDomain, then it works fine.

So it seems that the problem is that GetB returns proxy to an object
created in OtherDomain.

Has anyone experienced the same problem?

Regards,
Hrvoje Nezic

===================================
This list is hosted by DevelopMentorŽ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to