3

I created a .NET class library in C# and exposed it to COM. It works fine as an in-proc COM server. However I want to use it as an out-proc COM server to have it in a separate process.

To do so I try to create a COM+ application. I created an empty COM+ application and added the classes implemented in the class library into it. When I call CoCreateInstance() to instantiate a class implemented in the library, the COM+ surrogate process encounters an access violation and terminates (crash dump folows).

Are there any special steps needed to be taken to create a class library that can be used as an out-proc COM server under COM+?

The COM+ surrogate process crashes with the following crash dump:

Exception: C0000005
Address: 0x000C1618

Call Stack:
! + 0xC1618
mscorwks!Ordinal79 + 0xE41C
mscorwks!Ordinal79 + 0xE4AD
mscorwks!CoInitializeEE + 0x563F
mscorwks!CoInitializeEE + 0x5672
mscorwks!CoInitializeEE + 0x57F1
mscorwks!CoInitializeCor + 0x210E
mscorwks!CoInitializeCor + 0x48D
mscorwks!Ordinal79 + 0x16D2
mscorwks!ReleaseFusionInterfaces + 0x20B28
COMSVCS! + 0xC29A2
COMSVCS! + 0xC2BDA
COMSVCS!CoCreateStdTrustable + 0xCB10
ole32!CoMarshalInterface + 0x2642
ole32!CoInstall + 0x673
ole32!CoQueryAuthenticationServices + 0x1F44
ole32!CoQueryAuthenticationServices + 0x2862
ole32!CoWaitForMultipleHandles + 0xC267
ole32!CoQueryClientBlanket + 0x16CE
ole32!CoCreateObjectInContext + 0xC8E
ole32!CoInstall + 0x87A
ole32!CoWaitForMultipleHandles + 0x10479
ole32!CoMarshalInterface + 0x2808
ole32!CoGetTreatAsClass + 0xBE7
ole32!CoGetTreatAsClass + 0xB9E
ole32!CoMarshalInterface + 0x28F2
ole32!CoMarshalInterface + 0x2642
COMSVCS!CoCreateStdTrustable + 0x106A4
ole32!CoMarshalInterface + 0x2642
ole32!CoPopServiceDomain + 0x14FE
RPCRT4!CheckVerificationTrailer + 0x70
RPCRT4!NdrStubCall2 + 0x215
RPCRT4!CStdStubBuffer_Invoke + 0x82
ole32!StgGetIFillLockBytesOnFile + 0xFC92
ole32!StgGetIFillLockBytesOnFile + 0xFC3C
ole32!CoRevokeClassObject + 0xA3E
ole32!CoRevokeClassObject + 0x963
ole32!StgGetIFillLockBytesOnFile + 0xF872
ole32!WdtpInterfacePointer_UserMarshal + 0x80E
ole32!StgGetIFillLockBytesOnFile + 0xF792
RPCRT4!NdrGetTypeFlags + 0x1C9
RPCRT4!NdrGetTypeFlags + 0x12E
RPCRT4!NdrGetTypeFlags + 0x5A
RPCRT4!CreateStubFromTypeInfo + 0x2D7
RPCRT4!CreateStubFromTypeInfo + 0x318
RPCRT4!NdrConformantArrayFree + 0x2CB
RPCRT4!NdrConformantArrayFree + 0x20F
RPCRT4!I_RpcBCacheFree + 0x61C
RPCRT4!I_RpcBCacheFree + 0x43E
RPCRT4!I_RpcBCacheFree + 0x604
kernel32!GetModuleFileNameA + 0x1B4

2 Answers 2

1

Perhaps going through the ServicedComponent example in this answer will help:

Create Out-Of-Process COM in C#/.Net?

Sign up to request clarification or add additional context in comments.

2 Comments

Will I be able to also use the same class library as an in-proc COM server if I make it a serviced component?
I'm not sure if you can declare the activation type at run time. You will want to look through this: msdn.microsoft.com/en-us/library/wtk4bdsx(VS.80).aspx and this: msdn.microsoft.com/en-us/library/afha61xz(VS.80).aspx.
0

I suggest you take a look at .Net Remoting instead.

1 Comment

Will this allow me to use the C# class library from unmanaged C++ code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.