public override object GetValue(object component) {
#if DEBUG
if (PropDescUsageSwitch.TraceVerbose) {
string compName = "(null)";
if (component != null)
compName = component.ToString();
Debug.WriteLine("[" + Name + "]: GetValue(" + compName + ")");
}
#endif
if (IsExtender) {
Debug.WriteLineIf(PropDescUsageSwitch.TraceVerbose, "[" + Name + "]: ---> returning: null");
return null;
}
Debug.Assert(component != null, "GetValue must be given a component");
if (component != null) {
component = GetDebugInvokee(componentClass, component);
try {
return GetMethodValue.Invoke(component, null);
}
catch (Exception t) {
string name = null;
if (component is IComponent) {
ISite site = ((IComponent)component).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(SR.GetString(SR.ErrorPropertyAccessorException, Name, name, message), t);
}
catch {
throw;
}
}
Debug.WriteLineIf(PropDescUsageSwitch.TraceVerbose, "[" + Name + "]: ---> returning: null");
return null;
}