Hi,
I have written a COM-Server (InProcServer32, Dll)
that I'd like to use with .NET (The server contains some
API-wrappers, that cannot be easily accessed via P/Invoke).
To test my server, I have created a C#-Project and
included a reference to my server.
VS2005 has correctly created a Wrapper-Dll from
the type-library.
But when I try to create an instance of the CoClass
in question, I receive a COMException with a HRESULT
of 0x80040154 REGDB_E_CLASSNOTREG, means that the class
is not properly registered!
But the class IS registered!
I have checked the registry and have also tested
the server with an "unmanaged" C++-Client before!
Anyone out there who can help me
Thanks in advance
Reiner

Question about COM-Interop.
Tdar
Below is my code and Yes I have checked the Interop-Assembly.
using
System; using System.Runtime.InteropServices;using
CeFileExchLib; static void Main(string[] args){
CeFileExchangerClass fileExch;fileExch
= new CeFileExchangerClass(); fileExch.RapiConnectDevice();}
regards
Reiner
soconne
mivecxtr
Try
[STAThread]
static void Main() Maybe you're not able to marshal the call to the STA.Marek Istvanek
Willy,
yes, I'm absolutely sure...
best regards
Reiner
titote
Sorry, that's not the reason! Below is a copy of the Exception-Details from VS2005 and the code from my "unmanaged" client. Maybe this can help.
System.Runtime.InteropServices.COMException was unhandled
Message="Retrieving the COM class factory for component with CLSID {C84B4E51-96EB-4071-AC21-C3EAD122358C} failed due to the following error: 80040154."
Source="sharpcom"
ErrorCode=-2147221164
StackTrace:
at sharpcom.Program.Main(String[] args) in G:\Develop\VS2005\sharpcom\sharpcom\Program.cs:line 16
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
This is the code that works fine in the "native" C++-Client:
// class DECLSPEC_UUID("C84B4E51-96EB-4071-AC21-C3EAD122358C") CeFileExchanger;hResult
= ::CoInitialize(NULL);hResult
= ::CoGetClassObject(CLSID_CeFileExchanger, CLSCTX_INPROC_SERVER, NULL, IID_IClassFactory, void**)&pFactory);hResult
= pFactory->CreateInstance(NULL, IID_ICeFileExchanger, (void**)&pFileExch);regards
Reiner
stombiztalker