public void VisitFini(EndMethod end) { if (m_offset >= 0) { Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty); } }
internal void Dispatch(MethodInfo info) { DoSetExcluding(info.Method.ToString()); BeginMethod begin = new BeginMethod(); begin.Info = info; DoVisit(begin); m_visited.Clear(); if (info.Method.Body != null) { for (int i = 0; i < info.Graph.Roots.Length; ++i) { if (m_visited.IndexOf(info.Graph.Roots[i]) < 0) { DoVisit(info.Instructions, info.Graph.Roots[i], info.Instructions.Length - 1, 0, int.MinValue); } } } EndMethod end = new EndMethod(); end.Info = info; DoVisit(end); info.Reset(); // free up large objects we won't use again }
public void VisitEnd(EndMethod method) { if (m_offset >= 0) { Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, string.Empty); } }
public void VisitEnd(EndMethod method) { if (m_offset >= 0) { Log.DebugLine(this, m_details); Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, m_details); } }
public void VisitEnd(EndMethod end) { if (m_count > m_maxBranches) { Log.DebugLine(this, "found {0} branches", m_count); Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty); } }
public void VisitEnd(EndMethod end) { if (m_offset >= 0) { m_details = "Calling: " + m_details; Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, m_details); } }
public void VisitEnd(EndMethod end) { if (m_newOffsets.Count > m_setCount) { int offset = m_newOffsets.Count == 1 ? m_newOffsets[0] : 0; Reporter.MethodFailed(end.Info.Method, CheckID, offset, string.Empty); } }
public void VisitEnd(EndMethod end) { if (m_offset >= 0) { Log.DebugLine(this, "bad string at {0}",m_offset); Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty); } }
public void VisitEnd(EndMethod end) { if (m_needsCheck && m_offset >= 0) { m_details = "Words: " + m_details; Log.DebugLine(this, m_details); Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, m_details); } }
public void VisitEnd(EndMethod end) { if (m_numUnboxes > m_maxUnboxes) { string details = string.Format("found {0} unbox instructions", m_numUnboxes); Log.DebugLine(this, details); Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, details); } }
public void VisitEnd(EndMethod end) { if (m_args.Count > 0) { string details = "Args: " + string.Join(" ", m_args.ToArray()); Log.DebugLine(this, "{0}", details); Reporter.MethodFailed(end.Info.Method, CheckID, 0, details); } }
public void VisitEnd(EndMethod end) { if (m_offset < 0 && DoHasAssert(end.Info.Method.SecurityDeclarations)) m_offset = 0; if (m_offset >= 0) { if (!DoHasDemand(end.Info.Type.SecurityDeclarations) && !DoHasDemand(end.Info.Method.SecurityDeclarations)) { Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty); } } }
public void VisitEnd(EndMethod end) { string details = string.Empty; if (m_isEmpty) details += "Finalizer is empty." + Environment.NewLine; if (m_doesThrow) details += "Finalizer throws." + Environment.NewLine; if (m_notDisposable) details += "The type does not implement IDisposable." + Environment.NewLine; details = details.Trim(); if (details.Length > 0) { Log.DebugLine(this, "Details: {0}", details); Reporter.MethodFailed(end.Info.Method, CheckID, 0, details); } }
public void VisitEnd(EndMethod end) { if (m_numLocks == 1 && m_foundSingle && m_foundRet && !m_foundGuard) { Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty); } }
public void VisitMethodEnd(EndMethod end) { Unused.Value = end; if (m_equality != null) m_equalities.Add(m_equality); }
public void VisitEndMethod(EndMethod end) { if (m_offset >= 0) { Log.DebugLine(this, "identical operands at {0:X}", m_offset); Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty); } }
public void VisitEnd(EndMethod end) { if (m_needsCheck) { if (end.Info.Method.Name == "set_Item" && end.Info.Method.Parameters.Count == 2) { if (!m_found1 || !m_found2) Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty); } else { if (!m_found1) Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty); } } }
public void VisitEnd(EndMethod end) { if (m_needsCheck && m_failed) m_details += end.Info.Method.ToString() + " "; }
public void VisitEnd(EndMethod end) { if (m_offset >= 0) { string details = "Arg: " + m_badArg; Log.DebugLine(this, details); Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty); } }
public void VisitEnd(EndMethod end) { Unused.Value = end; if (m_needsCheck && m_missingBaseCall) { Reporter.MethodFailed(m_method, CheckID, 0, string.Empty); } }
public void VisitEnd(EndMethod end) { if (m_offset >= 0) { Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty); } else { foreach (int v in m_candidateLoads) { if (m_stores.IndexOf(v) >= 0) { Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty); return; } } } }
public void VisitEnd(EndMethod end) { if (m_foundCtor && !m_foundLocale) { Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty); } }
public void VisitEnd(EndMethod end) { if (m_offset >= 0) { string details = "Method: " + m_bad; Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, details); } }
public void VisitEnd(EndMethod end) { if (m_needsCheck) { string details = string.Empty; for (int i = m_types.Count - 1; i >= 1; --i) { if (m_types[i] != null) { if (m_types[i].Count == 1) { details = string.Format("Argument '{0}' can be declared as {1}. {2}", m_info.Method.Parameters[i - 1].Name, m_types[i][0].FullName, details); } else if (m_types[i].Count > 0) { TypeReference type = DoConsolidateTypes(m_types[i]); if (type != null && (type.FullName != m_formalTypes[i].FullName)) details = string.Format("Argument '{0}' can be declared as {1}. {2}", m_info.Method.Parameters[i - 1].Name, type.FullName, details); } } } if (details.Length > 0) { Log.DebugLine(this, details); Reporter.MethodFailed(end.Info.Method, CheckID, 0, details); } } }
public void VisitEnd(EndMethod method) { if (m_wasStatic) { if (!m_hasLock) { Log.DebugLine(this, "has no lock"); m_unlocked.Add(method.Info.Method); } if (m_setsState) { Log.DebugLine(this, "it's a static setter"); m_setters.Add(method.Info.Method); } } }
public void VisitMethodEnd(EndMethod end) { if (m_disposable) { if (m_needsThrowCheck && !m_doesThrow) { m_noThrowMethods += " " + end.Info.Method + Environment.NewLine; } // This is a tricky case because people may use arbitrary state to figure // out if a field is null or not. So, we'll be conservative and say there // is a problem if a nullable field is called and either there are no // branches or the only branch uses m_disposed. if (m_hasNoBranches && m_callsNullableField) { m_hasNullCall = true; } } }
public void VisitEnd(EndMethod end) { if (m_needsCheck) { float ratio = end.Info.Method.Body.Instructions.Count; if (m_numVirtuals > 0) ratio /= m_numVirtuals; if (ratio >= m_limit) { Log.DebugLine(this, "numVirtuals: {0}", (int) m_numVirtuals); Log.DebugLine(this, "ratio: {0}", ratio); Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty); } } }
public void VisitEnd(EndMethod end) { if (m_offset >= 0 && !m_foundEarlyReturn) Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, m_details); m_tracker = null; }
public void VisitEnd(EndMethod end) { Unused.Value = end; if (m_checkMethod) { foreach (string name in m_candidates) { if (!m_bad.Contains(name)) { Log.DebugLine(this, " bad call: {0}", name); m_bad.Add(name); } } } }
public void VisitEnd(EndMethod method) { if (m_offset >= 0) Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, m_details); }
public void VisitEnd(EndMethod method) { if (m_needsCheck) { if (!m_foundThis) Reporter.MethodFailed(method.Info.Method, CheckID, 0, string.Empty); } }