COM+ component calling other COM+ components - “Cannot load type”

  • Thread starter Thread starter Chandrashekhar C
  • Start date Start date
C

Chandrashekhar C

Guest
I have a two .NET assemblies which are registered as COM+ components and I'm testing them from a regular console application

"Dim objFirst As New MyFirstComponent() 'COM+ initialisation

Dim RC As Boolean = objFirst.GetValue()"

The method call is executed successfully. This is the definition of MyFirstComponent;

<ProgId("MyFirstComponent")> _
<Guid("...")> _
<ClassInterface(ClassInterfaceType.None)> _
<Transaction(TransactionOption.Supported)> _
Public Class MyFirstComponent
Inherits ServicedComponent
Implements IMyFirstComponent

Public Function GetValue() As Boolean Implements IMyFirstComponent.GetValue
Dim objSecond As New MySecondComponent() 'COM+ initialisation
Dim RC As Boolean = objSecond.GetValue()
Return RC
End Function

End Class


At the point where MySecondComponent is initialised, I get a RemotingException with the following message;


Cannot load type 'MySecondComponent', ..., Version=..., Culture=neutral, PublicKeyToken=...'

All assemblies are strongly named too. I cannot work out why I can successfully fire a method call to the first component, but when it tries to subsequently load up the second component itself, it can't resolve the type.

As a sidenote, if I run the code from the body of "GetValue()" in my dev, it executes as expected. The problem seems to only crop up once things have moved into the realm of COM+ components calling other COM+ components.

Any quick suggestions will be highly appreciated.


I have a two .NET assemblies which are registered as COM+ components and I'm testing them from a regular console application test harness;

Dim objFirst As New MyFirstComponent() 'COM+ initialisation
Dim RC As Boolean = objFirst.GetValue()


The method call is executed successfully. This is the definition of MyFirstComponent;

<ProgId("MyFirstComponent")> _
<Guid("...")> _
<ClassInterface(ClassInterfaceType.None)> _
<Transaction(TransactionOption.Supported)> _
Public Class MyFirstComponent
Inherits ServicedComponent
Implements IMyFirstComponent

Public Function GetValue() As Boolean Implements IMyFirstComponent.GetValue
Dim objSecond As New MySecondComponent() 'COM+ initialisation
Dim RC As Boolean = objSecond.GetValue()
Return RC
End Function

End Class


At the point where MySecondComponent is initialised, I get a RemotingException with the following message;


Cannot load type 'MySecondComponent', ..., Version=..., Culture=neutral, PublicKeyToken=...'

All assemblies are strongly named too. I cannot work out why I can successfully fire a method call to the first component, but when it tries to subsequently load up the second component itself, it can't resolve the type.

As a sidenote, if I run the code from the body of "GetValue()" in my test harness, it executes as expected. The problem seems to only crop up once things have moved into the realm of COM+ components calling other COM+ components.

Continue reading...
 
Back
Top