public bool EnableDebugging(OptimizerContext context, TypeDefinition type) { if (type.DeclaringType != null) { return(EnableDebugging(context, type.DeclaringType)); } if (DontDebugThis(type)) { return(false); } if (AutoDebugMain) { if (type.Namespace == "Martin.LinkerTest") { return(true); } if (type.Module.Assembly.Name.Name.ToLowerInvariant().Contains("martin")) { return(true); } } return(context.GetTypeEntries(type)?.Any(t => t.Action == TypeAction.Debug) ?? false); }
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 + "."); } }