예제 #1
0
        public void CheckFailList(OptimizerContext context, MethodDefinition method)
        {
            CheckFailList(context, method.DeclaringType, method.FullName);

            var entry = context.GetMethodEntries(method)?.FirstOrDefault(m => m.Action == MethodAction.Warn || m.Action == MethodAction.Fail);

            if (entry == null)
            {
                return;
            }

            var message = $"Found fail-listed method `{method.FullName}`";

            context.LogMessage(MessageImportance.High, Environment.NewLine);
            context.LogMessage(MessageImportance.High, message + ":");
            DumpFailEntry(context, entry);
            var stack = context.DumpTracerStack();

            OptimizerReport.FailList.Add(new FailListEntry(method, entry, stack));
            context.LogMessage(MessageImportance.High, Environment.NewLine);
            if (entry.Action == MethodAction.Fail)
            {
                throw new OptimizerException(message + ".");
            }
        }
예제 #2
0
        public void CheckFailList(OptimizerContext context, TypeDefinition type, string original = null)
        {
            var entry = context.GetTypeEntries(type)?.FirstOrDefault(t => t.Action == TypeAction.Warn || t.Action == TypeAction.Fail);

            if (entry == null)
            {
                return;
            }

            var original_message = original != null ? $" while parsing `{original}`" : string.Empty;
            var message          = $"Found fail-listed type `{type.FullName}`";

            context.LogMessage(MessageImportance.High, Environment.NewLine);
            context.LogMessage(MessageImportance.High, message + ":");
            DumpFailEntry(context, entry);
            var stack = context.DumpTracerStack();

            OptimizerReport.FailList.Add(new FailListEntry(type, entry, original, stack));
            context.LogMessage(MessageImportance.High, Environment.NewLine);
            if (entry.Action == TypeAction.Fail)
            {
                throw new OptimizerException(message + original_message + ".");
            }
        }