public void VisitCallGraph(CallGraph graph) { string details = string.Empty; List <string> chain = new List <string>(); foreach (MethodReference method in m_dispatcher.ClassifyMethod.ThreadRoots()) { chain.Clear(); m_visited.Clear(); if (DoFoundBadSetter(graph, method, chain)) { details = string.Format("{0}{1}{1}{2}", ListExtensions.Accumulate( chain, string.Empty, (s, e) => s.Length > 0 ? s + " -> " + Environment.NewLine + e : e), Environment.NewLine, details); } } details = details.Trim(); if (details.Length > 0) { Log.DebugLine(this, details); Reporter.AssemblyFailed(Cache.Assembly, CheckID, details); } }
private static string DoGetMissedOffsets(TypedInstructionCollection instructions, List <BasicBlock> reachable, List <BasicBlock> deadBlocks) { // Get a list of all the offsets in the method. List <int> offsets = new List <int>(instructions.Length); foreach (TypedInstruction instruction in instructions) { offsets.Add(instruction.Untyped.Offset); } // Remove the visited instructions. foreach (BasicBlock block in reachable) { DoRemoveOffsets(instructions, offsets, block); } // Remove the dead code. foreach (BasicBlock block in deadBlocks) { DoRemoveOffsets(instructions, offsets, block); } // Anything left is code we should have visited but didn't. return(ListExtensions.Accumulate(offsets, string.Empty, (s, e) => s + e.ToString("X2") + " ")); }