コード例 #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 bool EnableDebugging(OptimizerContext context, MethodDefinition method)
        {
            if (DontDebugThis(method.DeclaringType))
            {
                return(false);
            }
            if (EnableDebugging(context, method.DeclaringType))
            {
                return(true);
            }

            if (AutoDebugMain)
            {
                if (method.Name == "Main")
                {
                    return(true);
                }
                if (method.FullName.Contains("Martin"))
                {
                    return(true);
                }
            }

            return(context.GetMethodEntries(method)?.Any(m => m.Action == MethodAction.Debug) ?? false);
        }