title: fxcop CA2213 error in vs2010
body: <p>I have the following code:
  A disposable class that contains two disposable members.
  One of them is being initialized using new() method, and the other using static factory method.
  I Also have static code analisys rules, with CA2213 as error.</p>
  
  <pre><code>    public class DisposableClass : IDisposable
  {
      private WebClient m_DisposableMember1;
  
      public WebClient DisposableMember1
      {
          get
          {
              if (m_DisposableMember1 == null)
              {
                  m_DisposableMember1 = new WebClient();
              }
              return m_DisposableMember1;
          }
      }
  
      private WebClient m_DisposableMember2;
  
      public WebClient DisposableMember2
      {
          get
          {
              if (m_DisposableMember2 == null)
              {
                  m_DisposableMember2 = Factory.Create();
              }
              return m_DisposableMember2;
          }
      }
  
  
      #region Finalize/Dispose Pattern
      private bool m_IsDisposed = false;
  
      //Implement IDisposable.
      public void Dispose()
      {
          Dispose(true);
          GC.SuppressFinalize(this);
      }
  
      ~DisposableClass()
      {
          Dispose(false);
      }
  
      protected virtual void Dispose(bool disposing)
      {
          if (!m_IsDisposed)
          {
              if (disposing)
              {
                  DisposableMember1.Dispose();
                  // DisposableMember2 in not disposed and not notified by fxCop
              }
  
              m_IsDisposed = true;
          }
      }
      #endregion Finalize/Dispose Pattern
  
  }
  </code></pre>
  
  <p>This is the simple factory class:</p>
  
  <pre><code>    public static class Factory
  {
      public static WebClient Create()
      {
          return new WebClient();
      }
  }
  </code></pre>
  
  <p>When I call the Dispose() method of the DisposableMember1 property, I get CA2213.
  When I call the Dispose() method of the m_DisposableMember1 member, I don't get this error.</p>
  
  <p>More over, I don't get this error for m_DisposableMember2 (Wich was initialized using the static factory), and it is not being disposed.</p>
  
  <p>Does anybody familiar with this issue? What can cause this behavior?</p>