mercredi 14 décembre 2016

Method not Found in type loaded from GAC

I'm trying to load a type registered on COM+ and use a specific method in my code.

In this very simple test, I cannot find the method:

static void Main(string[] args)
{
    const string emailTypeName = "Foo.cEmail";
    const string emailMethodName = "FooMail";
    Type type = Type.GetTypeFromProgID(emailTypeName, true);
    object instance = Activator.CreateInstance(type);
    Type[] parameterTypes = new Type[] { typeof(string), typeof(int), typeof(string) };
    MethodInfo method = instance.GetType().GetMethod(emailMethodName, parameterTypes); // method not found 
}

But, I call this same method in a VBS file and works.

Someone have any ideia where I'm wrong?





Aucun commentaire:

Enregistrer un commentaire