All pastes #582815 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-22 02:52 UTC
rendered paste body
Index: System.ComponentModel/ReflectionPropertyDescriptor.cs
===================================================================
--- System.ComponentModel/ReflectionPropertyDescriptor.cs       (revision 80253)
+++ System.ComponentModel/ReflectionPropertyDescriptor.cs       (working copy)
@@ -146,9 +146,16 @@
                        DesignerTransaction tran = CreateTransaction (component);

                        object propertyHolder = MemberDescriptor.GetInvokee (_componentType, component);
-                       object old = GetValue (propertyHolder);
+                       object old;

                        try {
+                               old = GetValue (propertyHolder);
+                       } catch {
+                               /* there isn't an old value (property is write-only). */
+                               old = value;
+                       }
+
+                       try {
                                GetPropertyInfo ().SetValue (propertyHolder, value, null);
                                EndTransaction (component, tran, old, value, true);
                        } catch {