static bool CheckIsinst (Instruction ins) { if (!ins.Is (Code.Isinst)) return false; return (ins.Next.OpCode.FlowControl != FlowControl.Cond_Branch); }
void ReportCall (MethodDefinition method, Instruction ins, MethodReference call) { TypeReference type = ins.Is (Code.Newobj) ? call.DeclaringType : call.ReturnType; bool fluent = IsFluentLike (call); string msg = String.Format (CultureInfo.InvariantCulture, "Local of type '{0}' is not disposed of ({1}).", type.Name, fluent ? "is this a fluent-like API?" : "at least not locally"); Runner.Report (method, ins, Severity.High, fluent ? Confidence.Normal : Confidence.High, msg); }