0x800401f3 Invalid Class String for COMInterop Dll

2

I have a C# Dll Registered as COM Interop:

[Guid("B41C2229-DBBD-4614-AE28-BFAE82B10F20")]
    [InterfaceType(ComInterfaceType.InterfaceIsDual)]
    public interface ITestCls
    {
        [DispId(1)]
        string test(string input);
    }

    [Guid("5E88B6B8-AE17-40A0-917A-51DEBD818145")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("TestNm.TestCls")]       
    public class TestCls : ITestCls
    {
        public string test(string input)
        {
            Console.WriteLine("INSIDE CS :: ");
            return "CS ::  ARE YOU TESTING WITH THIS INPUT " + input;        
        }
    }

I tried to call the same from my C++ code :

    CoInitialize(NULL); 
    std::cout << data << '\n'; 
    _bstr_t bstrt(data);
    BSTR  lResult;  
    CComQIPtr<IWPrint> iWrapClass;
    HRESULT hresult;
    hresult = iWrapClass.CoCreateInstance(L"TestNm.TestCls");
    printf("0x%08lx", hresult); 
    if (SUCCEEDED (hresult))
    {
        iWrapClass->test(bstrt,&lResult);
        wprintf(L"Response  %s\n", lResult);
    }
    CoUninitialize();
    return lResult;

Everything works fine from my developer machine when I run the same from other machine HRESULT give me this :

 0x800401f3 

Am I missing some registering ?

Thanks

c#
c++
com
com-interop
asked on Stack Overflow Jul 16, 2013 by Suave Nti

2 Answers

1

A few things to try while troubleshooting:

  • set the target CPU Platform for your managed assembly to x86 (32-bit);
  • make sure the assembly has a strong name;
  • on the target machine, use the 32-bit version of RegAsm.exe (C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe, not C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe).
  • register it on the target machine with RegAsm.exe /codebase (a strong assembly name is required for that).
answered on Stack Overflow Aug 20, 2013 by noseratio
0

User contributions licensed under CC BY-SA 3.0