Forum Discussion

AvidDev_255591's avatar
Icon for Nimbostratus rankNimbostratus
Mar 22, 2016

add_member_v2 exception error : Invoke(string, object[])' is inaccessible due to its protection level

What am I doing wrong here?

        var iportType = assembly.GetExportedTypes().Where(o => o.FullName == "iControl.CommonAddressPort").First();
        dynamic ipPortDefinition = Activator.CreateInstance(iportType);

        var iControlMethodType = assembly.GetExportedTypes().Where(o => o.FullName == "iControl.LocalLBPool").First();

        // instantiate controlMethodType
        dynamic iControlMethodInstance = Activator.CreateInstance(iControlMethodType);

        ipPortDefinition.address = memberIP;
        ipPortDefinition.port = Convert.ToInt32( memberPort);

            iControlMethodInstance.Invoke("add_member_v2", iControlMethodInstance, new object[] 
                            { poolName, ipPortDefinition });

        catch (Exception e)
            throw e;

Any help is greatly appreciated, I've been pulling my hair for 2 days now.

1 Reply

  • Don't know .NET and it looks like you do, so I'm in very deep water here, but the prototype says:

        in String [] pool_names,
        in Common__AddressPort [] [] members

    It looks like you might want to convert poolName into an array containing the pool name as the only element. Then make sure that the ipPortDefinition is a nested array. Try that?