Thank you again!

The code I had had a stupid unrelated bug in it, and I thought I'd
seen the Properties & Fields collections being updated, when in fact
they weren't being.

Your feedback made me look again and I spotted my mistake (I was
skipping population if the collections were initially empty, DOH!)

I'm really cooking on gas now and should be able to complete my Open
Source Weaver this week :)!  Thanks so much.

I have a working ModuleInitializer weaver (allows methods to be called
when an Assembly is loaded - brilliant for automatic assembly
configuration loading!), I now have a working attribute property
populater (auto populates location information on marked attributes).
My challenge for tomorrow is going to be the toughest - here's a
hint :)


    [Export("<Aspect>")]
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field |
AttributeTargets.Event | AttributeTargets.Property |
AttributeTargets.Class)]
    public class MethodInterceptionAttribute : Attribute
    {
        [Export("<InterceptBegin>")]
        private bool MethodStart3([NotNull]dynamic parameters)
        {
            parameters.myFirstParam = "Test";
            parameters.anotherParam = 3;
            parameters.ExtraRandomData = Guid.NewGuid();

            // Return true to continue, or set
parameters.@ReturnValue@ and return false.
            return true;
        }

        [Export("<InterceptEnd>")]
        private T MethodEnd2<T>([NotNull]dynamic parameters)
        {
            Contract.Assert(parameters.ExtraRandomData.GetType() ==
typeof (Guid));
            return default(T);
        }
    }

Basically simple interception with no dependencies on compile time
assemblies :) (So no more NuGet dependency hell for me)


Thank you so much for your continuing help!!!

-- 
--
mono-cecil

Reply via email to