title: How to detect calls to a SPECIFIC method in FxCop via a custom rule -- what to put in Check method
body: <p>I want to disallow calls to a specific method (MessageBox.Show) via a custom FxCop rule. I know the mechanics of how to get an FxCop rule custom-implemented (the XML file, inheriting from BaseIntrospectionRule, etc.) My question here is what I put in the "Check" method.</p>
  
  <p>Below is the initial draft I have based on poking around a lot on the web, but I'm very puzzled as to what I would actually populate in the two fields marked with <strong><em>?????</em></strong> below. </p>
  
  <p>I'm not sure even this solution, as it exists, would work. What is the fool-proof to make sure I'm doing what I want -- which is catching all calls to MessageBox.Show?</p>
  
  <pre><code>public override ProblemCollection Check(Member member)
  {
      Method method = member as Method;
      if (method == null)
      {
          return null;
      }
      MetadataCollection&lt;Instruction&gt;.Enumerator enumerator = method.Instructions.GetEnumerator();
      while (enumerator.MoveNext())
      {
          Instruction current = enumerator.Current;
          switch (current.OpCode)
          {
              case OpCode.Call:
              case OpCode.Callvirt:
              {
                  Method method3 = current.Value as Method;
                  if (method3 == **?????**)
                  {
                      Problem item = new Problem(base.GetResolution(**?????**), current);
                      base.Problems.Add(item);
                  }
                  break;
              }
          }
      }
      return base.Problems;
  }
  </code></pre>