LoaderLock Detected and remoting

  • Thread starter Thread starter ropo
  • Start date Start date
R

ropo

I'm using .NET 2.0, I have a manged windows service which uses a mixed
C++ assembly. I also have a mangaged dll that defines the interface to
the mixed assembly. Another application communicates with the service
through remoting using the managed interface.

Mostly this works ok, but when a call a particular function I get the
"loadlock detected" exception. I have a test app that can call the
function successfully, the difference being that no remoting is
involved. I have tried putting a break point at the entry point of my
function, but this is never hit.

Any ideas?
 
I've narrowed this down a bit. The problem occurs in the following
case:

// shared interfaces C#.NET
interface A
{
B CreateB()
C CreateC()
}
interface B
{
void foo(C);
}
interface C
{
// some properties
}

// on the server C++.NET
class Aclass : public MarshalObjectByRef, public A
{
public:
virtual B CreateB() = A::CreateB { return (B)gcnew Bclass(); }
virtual C CreateC() = A::CreateC { return (C)gcnew Cclass(); }
};
class Bclass : public MarshalObjectByRef, public B
{
public:
virtual void foo(C obj) = B::foo { return; }
};
class Cclass : public MarshalObjectByRef, public c
{
// ...
};


// on the remote client C#.NET
B Bobj = A.CreateB();
C Cobj = A.CreateC();

// this works
Bobj.foo(null);

// this produces a load lock exception
Bobj.foo(Cobj);
 
Back
Top