title: Get custom attribute of method executed in action
body: <p>Here is my example metod</p>
  
  <pre><code>[TestStep("Do something")]
  private void DoSomething()
  {   
  }
  </code></pre>
  
  <p>Each method which looks like the one above is executed in a way which requires logging the method parameters:</p>
  
  <pre><code>private void LogStep(Action action)
  {
      string stepName = "[" + action.Method.Name + "] ";
      var descr = Attribute.GetCustomAttribute(action.Method, typeof(TestStepAttribute)) as TestStepAttribute;
  
      if (descr == null)
      {
          this.TestLog.AddWarningMessage(
              (action.Method.DeclaringType == null ? string.Empty : action.Method.DeclaringType.FullName + ".") + action.Method.Name
              + ": missing description");
  
          return;
      }
  
      stepName += descr.Description;
  
      this.TestLog.EndGroup();
  
      this.TestLog.BeginGroup(stepName);
  }
  </code></pre>
  
  <p>And here I come with a problem. Executing LogStep like</p>
  
  <pre><code>LogStep(DoSomething)
  </code></pre>
  
  <p>works perfectly, but when I execute it using lambda expression</p>
  
  <pre><code>LogStep(() =&gt; DoSomething())
  </code></pre>
  
  <p>It tells me that there are no attributes of type <code>TestStepAttribute</code> in that <code>Action</code>. </p>
  
  <p>At first glance it seems to be similar to <a href="https://stackoverflow.com/questions/4822461/how-do-i-get-the-custom-attributes-of-a-method-from-actiont">How do I get the custom attributes of a method from Action&lt;T&gt;?</a> but in my case I neither can change type of <code>Action</code> to <code>Expression&lt;Action&gt;</code> nor I know the method name.</p>
  
  <p>Any suggestion'd be helpful.</p>