Author Topic: C# Reflection - "(Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))"  (Read 6054 times)


  • Administrator
  • Full Member
  • *****
  • Posts: 69
How to resolve the error in C# Reflection - "(Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))"?

The most likely problem would be, you are invoking the method using C# reflection with misspelled name. Refer to the following example, the function AddTwoNumbers is the correct function name. If you give any undefined function name, then you will get this error.

using System.Reflection;

namespace SFTCSClientConsole
    class Program
        static void Main(string[] args)

                Type mathType = Type.GetTypeFromProgID("SFTComServer.MathControl");

                object mathInstance = Activator.CreateInstance(mathType);

                object[] arguments = new object[5] { 10, 15, 25 }; 

                object result = mathType.InvokeMember("SubtractTwoNumbers", BindingFlags.InvokeMethod,
                     null, mathInstance, arguments); // Would produce error - (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME)) as it is not defined in the COM Server 

                if(arguments[2] != null)


Additional Information: For server code, refer to the attachment:


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1