Unknown name ComException on a referenced dll in a C# project

-1

I'm writting a C# application which use one of the dll written in C++ as reference. I can use that dll namespace and my project compiles fine. However when I run it I keep getting error in one of the line where I assign a property its value. The exception error I got was the following:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
2013-06-03 12:26:32 - Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))
2013-06-03 12:26:32 -    at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
2013-06-03 12:26:32 -    at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
2013-06-03 12:26:32 -    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
2013-06-03 12:26:32 -    at sstObjTapLib._DsstObjTap.set_CapCode(String )
2013-06-03 12:26:32 -    at hpOutput.CTapPagerCom.MessageLoop() in c:\shs\Arial 8.1\XmarkClient\hpOutput\CTapPagerCom.cs:line 225

I initiated the dll object using the following code:

m_ctlTap = new sstObjTapLib.ctlTap();

Below are the three screenshots:

  1. The properties of the DLL I use
  2. The object browser of the dll I use
  3. A breakpoint that shows where the exception occurs.

Looking at the stack error above, it seems that .NET is trying to call some method that does not exist, but I'm just setting a property value. Can somebody point me in the right direction or what I might have missed?

A noted point: While in debugging, I'm looking at my loaded module view, however I don't see this dll name one in the list of my loaded module.

enter image description here enter image description here enter image description here

c#
c++
.net
dll
asked on Stack Overflow Jun 3, 2013 by Fylix

1 Answer

0

I'm not sure why but the computer I worked with had this same dll installed. I know this by viewing it using the third party tool called RegDllView .

So I went in, unregister the dll I was using, verify it is also gone from the registry and then re-register it again. Clean out my project and recompile everything, and got the exact code to work.

Looking at what I did I think for some reason the application did not recognize the GUID supplied to point to the proper COM.

answered on Stack Overflow Jun 3, 2013 by Fylix

User contributions licensed under CC BY-SA 3.0