title: Get Method name that threw exception
body: <p>I know. A similar question has already asked.</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4598255/how-to-get-the-name-of-the-method-that-caused-the-exception">How to get the name of the method that caused the exception</a></li>
  </ul>
  
  <p>but I haven't got the exact solution from that.</p>
  
  <p>I have a button click event in which I have a method <code>FillCombo()</code>.</p>
  
  <p><strong>Button Click event</strong></p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
        try
        {
            cmbTemplates.Items.Clear();
            lstFiles.Clear();
            FillCombo();                
        }
        catch (Exception ex)
        {
             MethodBase site = ex.TargetSite;
             Log(ex.ToString(), site == null ? null : site.Name);                
        }
  }
  </code></pre>
  
  <p>When I debugged, I found that the exception occurs from <code>FillCombo()</code> method. After that I get the value of <code>site.Name</code> as <code>WinIOError</code> instead of <code>FillCombo</code>.</p>
  
  <p>I tried another method <code>GetExecutingMethodName()</code> which was answered by <strong>Chris Gessler</strong> in <a href="https://stackoverflow.com/questions/4598255/how-to-get-the-name-of-the-method-that-caused-the-exception">How to get the name of the method that caused the exception</a> question. So I tried sending the name of method that caused exception using <code>GetExecutingMethodName()</code> method</p>
  
  <pre><code>Log(ex.ToString(), GetExecutingMethodName());
  </code></pre>
  
  <p>But I got the result as <code>System.Windows.Forms.Control.OnClick</code> instead of <code>FillCombo</code>.</p>
  
  <p><strong>How do I get the actual name of method that caused exception?</strong></p>