Cannot access C# COM library

1

I am building a COM class library with .NET 4 framework for FoxPro. Main code for library is quite small:

[ComVisible(true)]
[Guid("054fbf26-6d37-4d84-a732-fc49d77eeb21")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IFingerPrintEvents
{
    [DispId(1)]
    void OnFinger(int id);
}

[ComVisible(true)]
[Guid("7d07c9f9-a852-4287-9d7c-f5a9a6bdcf7b")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IFingerPrintDll
{
    [DispId(1)]
    string StartEnrollment();
    [DispId(2)]
    string Open(string connstring);
}

[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IFingerPrintEvents))]
[Guid("D9755E64-49A5-44ED-971F-64621DBEEEDF")]
[ProgId("FingerPrint.dll")]
public class FingerPrintDll : ServicedComponent, IFingerPrintDll
{
...(Implements IFingerPrintDll and events from IFingerPrintEvents)...
}

I build everything in x86, set COM visible true in assembly info and signed the library. I can register it with RegAsm with /tlb and /codebase tags but when I try to use it in FoxPro with CREATEOBJECT() it says "Unknown COM status Code. OLE Error 0x80004003". When I try to add it to C# app (to test) and try to initiate with GetTypeFromProgID and then Activator.CreateInstance it says "Object reference not set to an instance of an object.". Same is said when I try to add COM library through references. It shows no errors in code, but when I launch it shows same error. I did COM library on C# once and it works both in foxpro and C#, but main difference now is that my library uses web service through service reference. Maybe there is a problem there? All responses appreciated.

UPDATE

Okey, my bad, I had null reference exception in my constructor because of using uninitialised object... Stupidity level 9000

c#
web-services
com
asked on Stack Overflow Mar 17, 2015 by Domantas Žitkevičius • edited Mar 18, 2015 by Domantas Žitkevičius

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0