Beispiel #1
0
        public override void Execute()
        {
            var configOptions = new WeaverConfigOptions(Config);
            var config        = new WeaverConfig(configOptions, ModuleDefinition);
            var context       = new ModuleWeavingContext(ModuleDefinition, config);

            foreach (var type in ModuleDefinition.GetTypes())
            {
                foreach (var method in type.Methods)
                {
                    try
                    {
                        if (!MethodWeaver.NeedsProcessing(context, method))
                        {
                            continue;
                        }

                        _log.Debug($"Processing: {method.FullName}");
                        new MethodWeaver(context, method).Process();
                    }
                    catch (WeavingException ex)
                    {
                        AddError(ex.Message, ex.SequencePoint);
                        InvalidateMethod(method, ex.Message);
                    }
                }

                if (type.IsInlineILTypeUsageDeep(context))
                {
                    AddError($"Reference to InlineIL found in type {type.FullName}. InlineIL should not be referenced in attributes/constraints, as its assembly reference will be removed.", null);
                }
            }

            RemoveLibReference(context);
        }
Beispiel #2
0
        public void New()
        {
            var verts = new List <Type>();
            var edges = new List <Type>();

            var wc = new WeaverConfig(verts, edges);

            Assert.AreEqual(verts, wc.VertexTypes, "Incorrect Vertex list.");
            Assert.AreEqual(edges, wc.EdgeTypes, "Incorrect Edge list.");
        }
Beispiel #3
0
        public void NewWithPropFromGenericBase()
        {
            var verts = new List <Type>();
            var edges = new List <Type>();

            edges.Add(typeof(EdgeB));
            edges.Add(typeof(EdgeC));

            var wc = new WeaverConfig(verts, edges);

            Assert.AreEqual(verts, wc.VertexTypes, "Incorrect Vertex list.");
            Assert.AreEqual(edges, wc.EdgeTypes, "Incorrect Edge list.");
        }
Beispiel #4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        protected override void SetUp()
        {
            base.SetUp();

            var config = new WeaverConfig(ConfigHelper.VertexTypes, ConfigHelper.EdgeTypes);
            var query  = new WeaverQuery();            //should mock this, but it would be a pain

            vGraph     = new WeaverGraph();
            vPathItems = new List <IWeaverPathItem>();

            vMockPath = new Mock <IWeaverPath>();
            vMockPath.SetupGet(x => x.Config).Returns(config);
            vMockPath.SetupGet(x => x.Query).Returns(query);

            vMockPath
            .Setup(x => x.AddItem(It.IsAny <IWeaverPathItem>()))
            .Callback((IWeaverPathItem x) => vPathItems.Add(x));

            vGraph.Path = vMockPath.Object;
        }
 public SequencePointMapper(MethodDefinition method, WeaverConfig config)
 {
     _method = method;
     _config = config;
     _inputSequencePoints = _method.DebugInformation.SequencePoints.ToList();
 }
Beispiel #6
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 protected override void SetUp()
 {
     base.SetUp();
     vConfig = new WeaverConfig(ConfigHelper.VertexTypes, ConfigHelper.EdgeTypes);
 }
 public ModuleWeavingContext(ModuleDefinition module, WeaverConfig config)
 {
     Module = module;
     Config = config;
 }