11 private static readonly
object s_noValue =
new object();
67 if (attribute !=
null)
119 if (attribute !=
null)
145 BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.GetProperty;
210 while (baseType !=
null && baseType != typeof(
object))
214 if (property !=
null)
216 _setMethod =
property.GetSetMethod(nonPublic:
false);
233 BindingFlags bindingAttr2 = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.GetProperty;
276 [RequiresUnreferencedCode(
"PropertyDescriptor's PropertyType cannot be statically discovered.")]
278 : base(name, attributes)
286 if (componentClass ==
null)
299 [RequiresUnreferencedCode(
"PropertyDescriptor's PropertyType cannot be statically discovered.")]
301 : this(componentClass, name,
type, attrs)
306 if (getMethod !=
null && propInfo !=
null && setMethod ==
null)
316 [RequiresUnreferencedCode(
"PropertyDescriptor's PropertyType cannot be statically discovered.")]
318 : this(componentClass, name,
type, attrs)
326 [RequiresUnreferencedCode(
"PropertyDescriptor's PropertyType cannot be statically discovered.")]
328 : base(oldReflectPropertyDescriptor, attributes)
332 if (componentClass ==
null)
340 if (reflectPropertyDescriptor.ComponentType == componentClass)
342 _propInfo = reflectPropertyDescriptor._propInfo;
343 _getMethod = reflectPropertyDescriptor._getMethod;
344 _setMethod = reflectPropertyDescriptor._setMethod;
349 _state = reflectPropertyDescriptor._state;
351 if (attributes ==
null)
355 foreach (
Attribute attribute
in attributes)
376 if (component ==
null)
394 base.AddValueChanged(component, handler);
404 if (resetMethodValue !=
null)
407 if (shouldSerializeMethodValue !=
null)
412 return (
bool)shouldSerializeMethodValue.
Invoke(
obj,
new object[1] { component });
435 if (provider !=
null)
461 object oldValue =
null;
466 if (componentChangeService !=
null)
486 if (componentChangeService !=
null)
497 if (provider ==
null)
503 object oldValue =
null;
508 if (componentChangeService !=
null)
567 [UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"The DynamicDependency ensures the correct members are preserved.")]
605 [UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2072:UnrecognizedReflectionPattern", Justification =
"ReflectPropertyDescriptor ctors are all marked as RequiresUnreferencedCode because PropertyType can't be annotated as 'All'.")]
610 attributes.Add(attribute2);
614 while (
type !=
null &&
type != typeof(
object))
623 while (
type !=
null &&
type != typeof(
object))
626 BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public |
BindingFlags.NonPublic;
628 if (memberInfo !=
null)
649 if (!(type2 !=
null))
654 if (!
string.IsNullOrEmpty(attributeProviderAttribute.PropertyName))
657 if (member.Length != 0 && member[0] !=
null)
671 attributes.Add(value2);
684 attributes.Add(value3);
689 base.FillAttributes(attributes);
702 if (component !=
null)
704 component = GetInvocationTarget(_componentClass, component);
707 return GetMethodValue.Invoke(component,
null);
712 ISite site = ((component is
IComponent component2) ? component2.Site :
null);
713 if (site !=
null && site.
Name !=
null)
719 text = component.GetType().FullName;
725 string p = innerException.Message ?? innerException.
GetType().
Name;
736 OnValueChanged(component, e);
742 if (_state[s_bitChangedQueried] && _realChangedEvent ==
null)
744 base.OnValueChanged(component, e);
750 if (component ==
null)
764 base.RemoveValueChanged(component, handler);
765 if (GetValueChangedHandler(component) ==
null)
773 object invocationTarget = GetInvocationTarget(_componentClass, component);
774 if (DefaultValue != s_noValue)
776 SetValue(component, DefaultValue);
778 else if (AmbientValue != s_noValue)
780 SetValue(component, AmbientValue);
784 if (!(ResetMethodValue !=
null))
790 object oldValue =
null;
795 if (componentChangeService !=
null)
797 oldValue = GetMethodValue.Invoke(invocationTarget,
null);
811 if (ResetMethodValue !=
null)
813 ResetMethodValue.Invoke(invocationTarget,
null);
814 if (componentChangeService !=
null)
816 object newValue = GetMethodValue.Invoke(invocationTarget,
null);
825 if (component ==
null)
831 object invocationTarget = GetInvocationTarget(_componentClass, component);
841 if (componentChangeService !=
null)
843 obj = GetMethodValue.Invoke(invocationTarget,
null);
859 SetMethodValue.Invoke(invocationTarget,
new object[1] {
value });
879 component = GetInvocationTarget(_componentClass, component);
882 if (ShouldSerializeMethodValue !=
null)
886 return (
bool)ShouldSerializeMethodValue.Invoke(component,
null);
892 return AttributesContainsDesignerVisibilityContent();
894 if (DefaultValue == s_noValue)
896 if (ShouldSerializeMethodValue !=
null)
900 return (
bool)ShouldSerializeMethodValue.Invoke(component,
null);
908 return !
object.Equals(DefaultValue, GetValue(component));
bool Contains(Attribute? attribute)
static readonly CheckoutException Canceled
static readonly DesignerSerializationVisibilityAttribute Content
void RemoveEventHandler(object component, Delegate value)
void AddEventHandler(object component, Delegate value)
static ? ISite GetSite(object? component)
static ? MethodInfo FindMethod([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type componentClass, string name, Type[] args, Type returnType)
virtual AttributeCollection Attributes
virtual ? string PropertyName
EventHandler? GetValueChangedHandler(object component)
override? object GetInvocationTarget(Type type, object instance)
static readonly ReadOnlyAttribute Yes
MethodInfo _shouldSerializeMethod
void ExtenderSetValue(IExtenderProvider provider, object component, object value, PropertyDescriptor notifyDesc)
override void ResetValue(object component)
override Type ComponentType
static readonly int s_bitAmbientValueQueried
ReflectPropertyDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentClass, string name, Type type, PropertyInfo propInfo, MethodInfo getMethod, MethodInfo setMethod, Attribute[] attrs)
static readonly int s_bitDefaultValueQueried
override void FillAttributes(IList attributes)
static readonly int s_bitReadOnlyChecked
void OnINotifyPropertyChanged(object component, PropertyChangedEventArgs e)
void ExtenderResetValue(IExtenderProvider provider, object component, PropertyDescriptor notifyDesc)
static readonly int s_bitShouldSerializeQueried
static readonly int s_bitSetQueried
MethodInfo ShouldSerializeMethodValue
EventDescriptor _realIPropChangedEvent
static readonly int s_bitSetOnDemand
bool ExtenderCanResetValue(IExtenderProvider provider, object component)
object ExtenderGetValue(IExtenderProvider provider, object component)
override void RemoveValueChanged(object component, EventHandler handler)
override void SetValue(object component, object value)
Type ExtenderGetType(IExtenderProvider provider)
InterlockedBitVector32 _state
EventDescriptor ChangedEventValue
static readonly int s_bitChangedQueried
bool ExtenderShouldSerializeValue(IExtenderProvider provider, object component)
ReflectPropertyDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentClass, string name, Type type, Type receiverType, MethodInfo getMethod, MethodInfo setMethod, Attribute[] attrs)
static readonly object s_noValue
override bool ShouldSerializeValue(object component)
override bool SupportsChangeEvents
override void AddValueChanged(object component, EventHandler handler)
MethodInfo ResetMethodValue
MethodInfo SetMethodValue
bool AttributesContainsDesignerVisibilityContent()
MethodInfo GetMethodValue
static readonly int s_bitIPropChangedQueried
readonly Type _componentClass
readonly Type _receiverType
override Type PropertyType
static readonly int s_bitGetQueried
static readonly int s_bitResetQueried
override bool CanResetValue(object component)
override void OnValueChanged(object component, EventArgs e)
ReflectPropertyDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentClass, string name, Type type, Attribute[] attributes)
ReflectPropertyDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentClass, PropertyDescriptor oldReflectPropertyDescriptor, Attribute[] attributes)
EventDescriptor IPropChangedEventValue
override object GetValue(object component)
EventDescriptor _realChangedEvent
Type ExtenderGetReceiverType()
static Attribute[] ReflectGetAttributes(Type type)
static EventDescriptorCollection GetEvents([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
static AttributeCollection GetAttributes([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
static object ToObject(Type enumType, object value)
static readonly EventArgs Empty
Exception? InnerException
static CultureInfo InvariantCulture
object? Invoke(object? obj, object?[]? parameters)
MethodInfo? GetGetMethod()
MethodInfo? GetSetMethod()
static string ErrorPropertyAccessorException
static string ErrorMissingPropertyAccessors
static string InvalidNullArgument
static string Format(string resourceFormat, object p1)
static string ErrorInvalidPropertyType
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
PropertyInfo? GetProperty(string name)
virtual bool IsInstanceOfType([NotNullWhen(true)] object? o)
virtual Type GetEnumUnderlyingType()
static readonly Type[] EmptyTypes
MemberInfo[] GetMember(string name)
void OnComponentChanged(object component, MemberDescriptor? member, object? oldValue, object? newValue)
void OnComponentChanging(object component, MemberDescriptor? member)
object? GetService(Type serviceType)
delegate void PropertyChangedEventHandler(object? sender, PropertyChangedEventArgs e)
DynamicallyAccessedMemberTypes
void DangerousSet(int bit, bool value)