Example #1
0
        /// <inheritdoc/>
        public sealed override void OnSetValue(LocationInterceptionArgs args)
        {
            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (this == null)             //This is because of the case in TestPropertyAccessDuringConstructionReflection
            {
                args.ProceedSetValue();
                return;
            }

            args.ProceedSetValue();
            ReactiveManager.WasChanged(this);
        }
Example #2
0
        public void OnFieldSet(LocationInterceptionArgs args)
        {
            if (this.fieldValueComparer.AreEqual(args.LocationFullName, args.GetCurrentValue(), args.Value))
            {
                args.ProceedSetValue();
                return;
            }

            args.ProceedSetValue();


            this.childPropertyChangedProcessor.HandleFieldChange(args);

            PropertyChangesTracker.RaisePropertyChangedIfNeeded(args.Instance);
        }
Example #3
0
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     args.ProceedSetValue();
     Console.WriteLine("Writing to registry");
     Registry.SetValue(this.keyName, this.valueName, Convert.ToString(args.Value));
     this.isFetched = true;
 }
        public void OnFieldSet(LocationInterceptionArgs args)
        {
            //If a thread-unsafe field is accessed in a way which ignores checks (e.g. from static method or other instance), an exception should be thrown

            if (runningConstructors != null && runningConstructors.Contains(args.Instance))
            {
                return;
            }

            //Fields marked with ThreadSafe have already been exluded

            object key = this.GetRunningThreadSafeMethodsKey(args.Instance, args.Location.DeclaringType);

            if (IsContextThreadSafe(key))
            {
                return;
            }


            object sync = GetSyncObject(this.policy, args.Instance, args.Location.DeclaringType);

            ThreadHandle threadHandle;

            if (!locks.TryGetValue(sync, out threadHandle) || threadHandle.Thread != Thread.CurrentThread)
            {
                throw new LockNotHeldException(
                          "Fields not marked with ThreadSafe attribute can only be accessed from monitored ThreadUnsafe methods or methods marked as ThreadSafe.");
            }

            args.ProceedSetValue();
        }
 public void OnValueChange(LocationInterceptionArgs args)
 {
     if (!this.IsFrozen)
     {
         args.ProceedSetValue();
     }
 }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            var fireEvents   = EventSettings.BubblingEnabled && FireOnPropertyChange;
            var instance     = Instance;
            var locationName = args.LocationName;

            if (fireEvents)
            {
                EditActionAttribute.FireBeforeEventCall(instance, true);
                OnEntityEventMethod(instance, new PropertyChangingEventArgs(locationName),
                                    EntityEventType.PropertyChanging);
            }

            try
            {
                args.ProceedSetValue();
            }
            finally
            {
                if (fireEvents)
                {
                    try
                    {
                        OnEntityEventMethod(instance, new PropertyChangedEventArgs(locationName),
                                            EntityEventType.PropertyChanged);
                    }
                    finally
                    {
                        EditActionAttribute.FireAfterEventCall(instance, true, false);
                    }
                }
            }
        }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            // Don't go further if the new value is equal to the old one.
            // (Possibly use object.Equals here).
            if (args.Value == args.GetCurrentValue())
            {
                return;
            }

            // Actually sets the value.
            args.ProceedSetValue();

            // Ignore properties with AutoDirtyIgnoreAttribute.
            var propertyInfo = args.Location.PropertyInfo;

            if (propertyInfo.GetCustomAttributes(typeof(AutoDirtyIgnoreAttribute), true).Any())
            {
                return;
            }

            if (Instance is IDirty dirtyObject)
            {
                dirtyObject.SetDirty();
            }
        }
Example #8
0
 /// <summary>
 /// Method invoked <i>instead</i> of the <c>Get</c> semantic of the field or property to which the current aspect is applied,
 /// i.e. when the value of this field or property is retrieved.
 /// </summary>
 /// <param name="args">Advice arguments.</param>
 public override void OnGetValue(LocationInterceptionArgs args)
 {
     args.ProceedGetValue();
     if (args.Value == null)
     {
         if (string.IsNullOrEmpty(this.Token))
         {
             if (string.IsNullOrEmpty(this.TokenProperty))
             {
                 args.Value = IoC.Get(args.Location.LocationType);
             }
             else
             {
                 object value = ObjectProxyFactory.Get(args.Instance).GetValue(args.Instance, this.TokenProperty);
                 if (value == null)
                 {
                     args.Value = IoC.Get(args.Location.LocationType);
                 }
                 else
                 {
                     args.Value = IoC.Get(args.Location.LocationType, value.ToString());
                 }
             }
         }
         else
         {
             args.Value = IoC.Get(args.Location.LocationType, this.Token);
         }
         args.ProceedSetValue();
     }
 }
        /// <summary>
        ///   Method executed when the field or property is being read.
        /// </summary>
        /// <param name="args">Description of the current operation.</param>
        public void OnSetValue(LocationInterceptionArgs args)
        {
            RequirePermission(args.Location.FieldInfo ?? (MemberInfo)args.Location.PropertyInfo, OperationSemantic.Write, 0,
                              args.Instance);

            args.ProceedSetValue();
        }
Example #10
0
 /// <summary>
 /// Method invoked <i>instead</i> of the <c>Get</c> semantic of the field or property to which the current aspect is applied,
 /// i.e. when the value of this field or property is retrieved.
 /// </summary>
 /// <param name="args">Advice arguments.</param>
 public override void OnGetValue(LocationInterceptionArgs args)
 {
     args.ProceedGetValue();
     if (args.Value == null)
     {
         if (string.IsNullOrEmpty(this.Token))
         {
             if (string.IsNullOrEmpty(this.TokenProperty))
             {
                 args.Value = IoC.Get(args.Location.LocationType);
             }
             else
             {
                 object value = ObjectProxyFactory.Get(args.Instance).GetValue(args.Instance, this.TokenProperty);
                 if (value == null)
                 {
                     args.Value = IoC.Get(args.Location.LocationType);
                 }
                 else
                 {
                     args.Value = IoC.Get(args.Location.LocationType, value.ToString());
                 }
             }
         }
         else
         {
             args.Value = IoC.Get(args.Location.LocationType, this.Token);
         }
         args.ProceedSetValue();
     }
 }
        public void OnSetField( LocationInterceptionArgs args )
        {
            if ( this.IsFrozen )
                throw new InvalidOperationException("The object is frozen.");

            args.ProceedSetValue();
        }
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     if (HashedValuesStore.Get().ContainsKey(propname))
         HashedValuesStore.Get()[propname] = HashValue(args.Value.ToString());
     else
         HashedValuesStore.Get().Add(propname, HashValue(args.Value.ToString()));
     args.ProceedSetValue();
 }
Example #13
0
 public void OnSetValue(LocationInterceptionArgs args)
 {
     if (args.Value != args.GetCurrentValue())
     {
         args.ProceedSetValue();
         this.OnPropertyChanged(args.Location.Name);
     }
 }
Example #14
0
 public void OnSetValue(LocationInterceptionArgs args)
 {
     if (ValidateDelegate((T)args.Value)?.Any() == true)
     {
         throw new ArgumentException("...");
     }
     args.ProceedSetValue();
 }
 public void OnSetValue( LocationInterceptionArgs args )
 {
     if ( args.Value != args.GetCurrentValue() )
     {
         args.ProceedSetValue();
         this.OnPropertyChanged( args.Location.Name );
     }
 }
Example #16
0
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            var locationInfo = args.Location;

            if (locationInfo.LocationType == typeof(string))
            {
                CrossSettings.Current.AddOrUpdateValue(args.LocationFullName, (string)args.Value);
                args.ProceedSetValue();
                return;
            }

            if (locationInfo.LocationType == typeof(double))
            {
                CrossSettings.Current.AddOrUpdateValue(args.LocationFullName, (double)args.Value);
                args.ProceedSetValue();

                return;
            }

            if (locationInfo.LocationType == typeof(Int32))
            {
                CrossSettings.Current.AddOrUpdateValue(args.LocationFullName, (Int32)args.Value);
                args.ProceedSetValue();

                return;
            }

            if (locationInfo.LocationType == typeof(Int64))
            {
                CrossSettings.Current.AddOrUpdateValue(args.LocationFullName, (Int64)args.Value);
                args.ProceedSetValue();

                return;
            }

            if (locationInfo.LocationType == typeof(bool))
            {
                CrossSettings.Current.AddOrUpdateValue(args.LocationFullName, (bool)args.Value);
                args.ProceedSetValue();

                return;
            }

            if (locationInfo.LocationType == typeof(decimal))
            {
                CrossSettings.Current.AddOrUpdateValue(args.LocationFullName, (decimal)args.Value);
                args.ProceedSetValue();

                return;
            }

            if (locationInfo.LocationType == typeof(DateTime))
            {
                CrossSettings.Current.AddOrUpdateValue(args.LocationFullName, (DateTime)args.Value);

                args.ProceedSetValue();

                return;
            }
        }
        public void OnSetValue(LocationInterceptionArgs args)
        {
            if (args.Value != args.GetCurrentValue())
            {
                args.ProceedSetValue();

                this.OnPropertyChangedMethod.Invoke(null);
            }
        }
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            if (args.Value != null)
            {
                args.Value = ((string)args.Value).Trim().ToLowerInvariant();
            }

            args.ProceedSetValue();
        }
Example #19
0
 public void OnPropertySet(LocationInterceptionArgs args)
 {
     if (args.Value == args.GetCurrentValue())
     {
         return;
     }
     args.ProceedSetValue();
     NotifyChanges(new[] { args.LocationName });
 }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            if (!this.propertySetList.Contains(args.LocationName))
            {
                this.propertySetList.Add(args.LocationName);
            }

            args.ProceedSetValue();
        }
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            if (args.Value != null && args.Value is string)
            {
                args.Value = SampleEncryptor.Encrypt((string)args.Value);
            }

            args.ProceedSetValue();
        }
Example #22
0
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            if (args.Value == args.GetCurrentValue())
            {
                return;
            }

            args.ProceedSetValue();
        }
Example #23
0
 /// <summary>
 /// Method invoked <i>instead</i> of the <c>Get</c> semantic of the field or property to which the current aspect is applied,
 /// i.e. when the value of this field or property is retrieved.
 /// </summary>
 /// <param name="args">Advice arguments.</param>
 public override void OnGetValue(LocationInterceptionArgs args)
 {
     args.ProceedGetValue();
     if (args.Value == null)
     {
         args.Value = LogManager.GetLogger(args.Location.DeclaringType);
         args.ProceedSetValue();
     }
 }
Example #24
0
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            foreach (var propertyAccessRule in this.propertyAccessRules)
            {
                propertyAccessRule.OnPropertySet(args.Location.PropertyInfo);
            }

            args.ProceedSetValue();
        }
 public override void OnGetValue(LocationInterceptionArgs args)
 {
     args.Value = args.GetCurrentValue();
     if (args.Value == null)
     {
         args.Value = Dependencies.Get(args.Location.LocationType);
         args.ProceedSetValue();
     }
 }
Example #26
0
        public void OnFieldSet(LocationInterceptionArgs args)
        {
            if (this.IsFrozen)
            {
                throw new InvalidOperationException();
            }

            args.ProceedSetValue();
        }
Example #27
0
 /// <summary>
 /// Method invoked <i>instead</i> of the <c>Get</c> semantic of the field or property to which the current aspect is applied,
 /// i.e. when the value of this field or property is retrieved.
 /// </summary>
 /// <param name="args">Advice arguments.</param>
 public override void OnGetValue(LocationInterceptionArgs args)
 {
     args.ProceedGetValue();
     if (args.Value == null)
     {
         args.Value = LogManager.GetLogger(args.Location.DeclaringType);
         args.ProceedSetValue();
     }
 }
Example #28
0
    public void OnPropertySet(LocationInterceptionArgs args)
    {
        if (args.Value == args.GetCurrentValue())
        {
            return;
        }

        args.ProceedSetValue();
        this.OnPropertyChangedMethod.Invoke(args.Location.Name);
    }
 public void PrivateTrackerOnFieldSet(LocationInterceptionArgs args)
 {
     using (this.privateTracker.StartImplicitOperationScope(string.Empty))
     {
         object oldValue = args.GetCurrentValue();
         args.ProceedSetValue();
         object newValue = args.Value;
         this.privateTracker.AddToCurrentOperation(new FieldValueChange(this.Instance, args.Location.DeclaringType, args.LocationFullName, oldValue, newValue));
     }
 }
        public void OnFieldSet(LocationInterceptionArgs args)
        {
            if (FireOnPropertyChange || FireOnCollectionChange)
            {
                Unsubscribe(args.GetCurrentValue());
                Subscribe(args.Value);
            }

            args.ProceedSetValue();
        }
 public void OnObservedReferencePropertySet(LocationInterceptionArgs args)
 {
     var oldInstance = args.GetCurrentValue() as INotifyPropertyChanged;
     var newInstance = args.Value as INotifyPropertyChanged;
     if (oldInstance != null)
         oldInstance.PropertyChanged -= ObservedPropertyHandlers[args.LocationName].Invoke;
     if (newInstance != null)
         newInstance.PropertyChanged += ObservedPropertyHandlers[args.LocationName].Invoke;
     args.ProceedSetValue();
 }
        /// <summary>
        /// Called when the field or property is 'set'
        /// </summary>
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            // If it was not initialized yet, mark it as such now
            if (!_isInitialized)
            {
                _isInitialized = true;
            }

            args.ProceedSetValue();             // Proceed with the set
        }
 public void OnObservedCollectionPropertySet(LocationInterceptionArgs args)
 {
     var oldInstance = args.GetCurrentValue() as INotifyCollectionChanged;
     var newInstance = args.Value as INotifyCollectionChanged;
     if (oldInstance != null)
         oldInstance.CollectionChanged -= ObservedCollectionHandlers[args.LocationName];
     if (newInstance != null)
         newInstance.CollectionChanged += ObservedCollectionHandlers[args.LocationName];
     args.ProceedSetValue();
 }
            public void OnFieldSet(LocationInterceptionArgs args)
            {
                //Fields marked with ThreadSafe have already been exluded

                if (!IsContextThreadSafe(args.Instance))
                {
                    VerifyThreadAffinity();
                }

                args.ProceedSetValue();
            }
        public void OnPropertySet( LocationInterceptionArgs args )
        {
            // Don't go further if the new value is equal to the old one.
            // (Possibly use object.Equals here).
            if ( args.Value == args.GetCurrentValue() ) return;

            // Actually sets the value.
            args.ProceedSetValue();

            this.OnPropertyChangedMethod.Invoke( args.Location.Name );
        }
Example #36
0
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            bool isChanging = args.GetCurrentValue() != args.Value;

            args.ProceedSetValue();

            if (args.Instance is ViewModelBase vm && isChanging)
            {
                vm.OnPropertyChanged(args.LocationName);
            }
        }
    public override void OnGetValue(LocationInterceptionArgs args)
    {
        args.ProceedGetValue();
        if (args.Value != null)
        {
            return;
        }

        args.Value = DefaultValue;
        args.ProceedSetValue();
    }
Example #38
0
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            //base.OnSetValue(args);
            var oldValue = args.GetCurrentValue();
            var newValue = args.Value;

            if (oldValue != newValue)
            {
                args.ProceedSetValue();
                RaisePropertyChanged(args.Instance, args.LocationName);
            }
        }
        public void OnSetValue( LocationInterceptionArgs args )
        {
            if ( args.Value != args.GetCurrentValue() )
            {
                args.ProceedSetValue();

               // We don't pass the property name because the UI is bound to
               // derived properties (DisplayName). We should track property
               // dependencies to do this correctly.
               this.OnPropertyChangedMethod(null);
            }
        }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            if (args.Location.PropertyInfo.GetSetMethod(true) != null &&
                args.Location.PropertyInfo.DeclaringType != typeof(ContextSpecificationBase) &&
                this.propertySetList.Contains(args.LocationName))
            {
                throw new PropertyAlreadyInitializedException(args.LocationFullName);
            }

            this.propertySetList.Add(args.LocationName);

            args.ProceedSetValue();
        }
Example #41
0
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     var oldValue = args.GetCurrentValue();
     var newValue = args.Value;
     if (oldValue != newValue)
     {
         args.ProceedSetValue();
         RaisePropertyChanged(args.Instance, args.LocationName);
         if(_derivedProperties != null)
             foreach (var derivedProperty in _derivedProperties)
                 RaisePropertyChanged(args.Instance, derivedProperty);
     }
 }
        /// <summary>
        /// Method intercepting all changes on field, making sure that the
        /// setting value matches the regular expression
        /// </summary>
        /// <param name="locationInterceptionArgs">Location Interception Arguments</param>
        //[OnLocationSetValueAdvice]
        //[MulticastPointcut(Targets = MulticastTargets.Property,
        //                    Attributes = MulticastAttributes.Public)]
        public override void OnSetValue(LocationInterceptionArgs locationInterceptionArgs)
        {
            bool isValid = RegEXPatterns.MatchFound(
                locationInterceptionArgs.Value.ToString(),
                this.Pattern);

            if (isValid == false)
            {
                return;
            }

            locationInterceptionArgs.ProceedSetValue();
        }
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            args.ProceedSetValue();

            RaisePropertyChanged.Invoke(args.Instance, new object[] { args.Location.Name });

            if (_additionalAffectedProperties != null)
            {
                foreach (var affected in _additionalAffectedProperties)
                {
                    RaisePropertyChanged.Invoke(args.Instance, new object[] { affected });
                }
            }
        }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            // Don't go further if the new value is equal to the old one.
            // (Possibly use object.Equals here).
            if (args.Value == args.GetCurrentValue())
            {
                return;
            }

            OnPropertyChangingMethod.Invoke(args.Location.Name);

            // Actually sets the value.
            args.ProceedSetValue();
        }
 public void SetProperty( LocationInterceptionArgs args )
 {
     if ( args.Value != args.GetCurrentValue() )
     {
         using ( Post.Cast<Entity, IReaderWriterSynchronized>( parent ).AcquireWriteLock() )
         {
             // Change the EntityStatus flag before the value
             // is actually changed, so the PropertyChanged
             // event is fired when EntityStatus is correct.
             this.OnEntityPropertyUpdated();
             args.ProceedSetValue();
         }
     }
 }
Example #46
0
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            // Don't go further if the new value is equal to the old one.
            // (Possibly use object.Equals here).
            if (args.Value == args.GetCurrentValue())
            {
                return;
            }

            // Actually sets the value.
            args.ProceedSetValue();

            Dirty.IsDirty = true;
        }
Example #47
0
        public void OnSetValue( LocationInterceptionArgs args )
        {
            object currentValue = args.GetCurrentValue();
            if ( args.Value == currentValue )
                return;

            if ( this.IsInitialized == null || this.IsInitialized.Get() )
            {
                // Record changes only when the object is initialized.
                UndoManager.Record( new UndoItem( this, args.Value, currentValue, args.Binding ) );
            }

            args.ProceedSetValue();
        }
        //[ProvideAspectRole(StandardRoles.DataBinding)]
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            // Don't go further if the new value is equal to the old one.
            // (Possibly use object.Equals here).
            var currentValue = args.GetCurrentValue();
            if (args.Value == null && currentValue == null) return;
            if (args.Value == currentValue) return;

            // Actually sets the value.
            args.ProceedSetValue();

            //Console.WriteLine("Calling OnPropertyChanged(\"{0}\"), new value is |{1}|", args.LocationName, args.Value);
            // Invoke method OnPropertyChanged (our, the base one, or the overridden one).
            OnPropertyChangedMethod.Invoke(args.Location.Name);
        }
        public override void OnSetValue(LocationInterceptionArgs args)
        {
            // Don't go further if the new value is equal to the old one.
            // (Possibly use object.Equals here).
            if (args.Value == args.GetCurrentValue()) return;

            // Actually sets the value.
            args.ProceedSetValue();

            //var instance = args.Instance as INotifyPropertyChanged;
            //instance.PropertyChanged(instance, new PropertyChangedEventArgs("foo"));
            // Invoke method OnPropertyChanged (our, the base one, or the overridden one).
            foreach (var propertyName in PropertyNames)
                OnPropertyChangedMethod.Invoke(propertyName);
        }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            // Don't go further if the new value is equal to the old one.
            // (Possibly use object.Equals here).
            if (args.Value == args.GetCurrentValue()) return;

            // Actually sets the value.
            args.ProceedSetValue();

            // Invoke method OnPropertyChanged (our, the base one, or the overridden one).
// ReSharper disable RedundantThisQualifier
            this.OnPropertyChangedMethod.Invoke(args.Location.Name);
// ReSharper restore RedundantThisQualifier

        }
        public void OnFieldSet(LocationInterceptionArgs args)
        {
            using (this.ThisTracker.StartImplicitOperationScope(string.Format(this.FieldSetOperationStringFormat, args.LocationName)))
            {
                object oldValue = args.GetCurrentValue();

                if (oldValue != null && this.TrackedFields.Contains(args.LocationFullName))
                {
                    this.ThisTracker.DetachFromAggregate( oldValue, this.EnableTrackingOnTrackerCreation );
                }

                args.ProceedSetValue();
                object newValue = args.Value;

                if (newValue != null && this.TrackedFields.Contains(args.LocationFullName))
                {
                    this.ThisTracker.AttachToAggregate( newValue );
                }

                this.ThisTracker.AddToCurrentOperation(new FieldValueChange(this.Instance, args.Location.DeclaringType, args.LocationFullName, oldValue, newValue));
            }
        }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            var baseErrorViewModel = Instance as BaseErrorViewModel;
            if (baseErrorViewModel == null)
            {
                return;
            }

            args.ProceedSetValue();

            // clear old errors
            baseErrorViewModel.SetError(args.Location.Name, "");

            foreach (var att in args.Location.PropertyInfo.GetCustomAttributes(typeof(ValidationAttribute), false))
            {
                if (!((ValidationAttribute)att).IsValid(args.Value))
                {
                    baseErrorViewModel.SetError(args.Location.Name, ((ValidationAttribute)att).FormatErrorMessage(GetDisplayName(args.Location)));
                    break;
                }
            }
            baseErrorViewModel.OnPropertyChanged(args.Location.Name);
        }
        public void OnPropertySet(LocationInterceptionArgs args)
        {
            foreach (var propertyAccessRule in this.propertyAccessRules)
            {
                propertyAccessRule.OnPropertySet(args.Location.PropertyInfo);
            }

            args.ProceedSetValue();
        }
 public override void OnSetValue(LocationInterceptionArgs args)
 {
     _valueSet = true;
     args.ProceedSetValue();
 }
Example #55
0
        public void OnFieldSet(LocationInterceptionArgs args)
        {
            if (FireOnPropertyChange || FireOnCollectionChange)
            {
                Unsubscribe(args.GetCurrentValue());
                Subscribe(args.Value);
            }

            args.ProceedSetValue();
        }
 public void PrivateTrackerOnFieldSet(LocationInterceptionArgs args)
 {
     using (this.privateTracker.StartImplicitOperationScope(string.Empty))
     {
         object oldValue = args.GetCurrentValue();
         args.ProceedSetValue();
         object newValue = args.Value;
         this.privateTracker.AddToCurrentOperation(new FieldValueChange(this.Instance, args.Location.DeclaringType, args.LocationFullName, oldValue, newValue));
     }
 }
        public void OnFieldSet(LocationInterceptionArgs args)
        {
            //If a thread-unsafe field is accessed in a way which ignores checks (e.g. from static method or other instance), an exception should be thrown

            if (runningConstructors != null && runningConstructors.Contains(args.Instance)) return;

            //Fields marked with ThreadSafe have already been exluded

            object key = this.GetRunningThreadSafeMethodsKey(args.Instance, args.Location.DeclaringType);
            if (IsContextThreadSafe(key)) return;

            object sync = GetSyncObject(this.policy, args.Instance, args.Location.DeclaringType);

            ThreadHandle threadHandle;
            if (!locks.TryGetValue(sync, out threadHandle) || threadHandle.Thread != Thread.CurrentThread)
            {
                throw new LockNotHeldException(
                    "Fields not marked with ThreadSafe attribute can only be accessed from monitored ThreadUnsafe methods or methods marked as ThreadSafe.");
            }

            args.ProceedSetValue();
        }
            public void OnFieldSet(LocationInterceptionArgs args)
            {
                //Fields marked with ThreadSafe have already been exluded

                if (!IsContextThreadSafe(args.Instance))
                {
                    VerifyThreadAffinity();
                }

                args.ProceedSetValue();
            }
        public void OnLocationSetValue(LocationInterceptionArgs args)
        {
            var proxy = GetProxy(args);

            if (proxy != null)
            {
                proxy.InterceptSet(args.Binding, args.Value);
                return;
            }

            args.ProceedSetValue();
        }
        public void OnFieldSet( LocationInterceptionArgs args )
        {
            if ( this.fieldValueComparer.AreEqual( args.LocationFullName, args.GetCurrentValue(), args.Value ) )
            {
                args.ProceedSetValue();
                return;
            }

            args.ProceedSetValue();

            this.childPropertyChangedProcessor.HandleFieldChange( args );

            PropertyChangesTracker.RaisePropertyChangedIfNeeded( args.Instance );
        }