public override object GetValue(object component)
{
Debug.WriteLine($"[{Name}]: GetValue({component?.GetType().Name ?? "(null)"})");
if (IsExtender)
{
Debug.WriteLine("[" + Name + "]: ---> returning: null");
return null;
}
Debug.Assert(component != null, "GetValue must be given a component");
if (component != null)
{
component = GetInvocationTarget(_componentClass, component);
try
{
return GetMethodValue.Invoke(component, null);
}
catch (Exception t)
{
string name = null;
IComponent comp = component as IComponent;
if (comp != null)
{
ISite site = comp.Site;
if (site != null && site.Name != null)
{
name = site.Name;
}
}
if (name == null)
{
name = component.GetType().FullName;
}
if (t is TargetInvocationException)
{
t = t.InnerException;
}
string message = t.Message;
if (message == null)
{
message = t.GetType().Name;
}
throw new TargetInvocationException(string.Format(SR.ErrorPropertyAccessorException, Name, name, message), t);
}
}
Debug.WriteLine("[" + Name + "]: ---> returning: null");
return null;
}