Problem with Activator.createinstance method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vignesh28
    New Member
    • Nov 2007
    • 1

    #1

    Problem with Activator.createinstance method

    hi ..
    i got the following error in activator.creat einstance method

    'Exception has been thrown by the target of an invocation.' this is the error.


    here is my code:

    public object getService(Stri ng name)
    {
    object o = services[name];
    if (null != o)
    {
    return o;
    }
    Type t = Type.GetType(PA CKAGE_PREFIX + version + "." + name);
    o = Activator.Creat eInstance(t);
    foreach(String headerName in HEADERS)
    {
    FieldInfo f = t.GetField(head erName + "Value");
    if ((f != null) && (this.headers[headerName] != null))
    {
    f.SetValue(o, this.headers[headerName]);
    }
    }
    if (alternateUrl != null)
    {
    setUrlPrefix((S oapHttpClientPr otocol) o, alternateUrl);
    }
    services.Add(na me, o);
    return o;
    }o;
Working...