tags:

views:

12

answers:

0

I am using Postsharp, i have this aspect (lets call it AspectA) that implements OnFieldAccessAspect.

Then i have a field:

[AspectA]
private object fieldA;

When i set fieldA value the first time:

fieldA = objectX;

In OnSetValue, i have eventArgs.StoredFieldValue == null and eventArgs.ExposedFieldValue== objectX, this is what i expected.

But when i set fieldA to a null value:

   fieldA = null;

In OnSetValue i have eventArgs.StoredFieldValue == null, eventArgs.ExposedFieldValue== null, even before i do:

eventArgs.StoredFieldValue = eventArgs.ExposedFieldValue

I expected do have eventArgs.StoredFieldValue == objectX, eventArgs.ExposedFieldValue== null.

But i need to use the fieldA value, that should be stored in eventArgs.StoredFieldValue , before it is set to null.

Is this the expected behaviour when setting a field to null? Is there a workaround so i can do some processing to the field value before its set to null?

Thanks