title: IDE0059 Unnecessary assignment of a value to 'i'
body: <p>This code produces in Visual Studio 2019 Information Message:
  *Severity   Code    Description Project File    Line    Suppression State   Suppression State   Detail Description
  Message IDE0059 </p>
  
  <p>Unnecessary assignment of a value to 'i'</p>
  
  <p>Avoid unnecessary value assignments in your code, as these likely indicate redundant value computations. 
  If the value computation is not redundant and you intend to retain the assignment, then change the assignment target to a local variable whose name starts with an underscore and is optionally followed by an integer, such as '_', '_1', '_2', etc. These are treated as special discard symbol names.*</p>
  
  <p>The code snippet works OK, it's the message IDE0059, what bothers me. I don't want to suppress it, if is possible. </p>
  
  <pre><code>    private static XmlDocument LoadXmlFromFile(string xmlPath)
      {
          XmlDocument doc = new XmlDocument();
          int i = 2;
          while (true)
          {
              try
              {
                  using (Stream fileStream = System.IO.File.Open(xmlPath, FileMode.Open, FileAccess.Read, FileShare.None))
                  {
                      doc.Load(fileStream);
                  }
  
                  return doc;
              }
              catch (IOException) when (i &gt; 0)
              {
                  i--;
                  Thread.Sleep(100);
  
              }
          }
      }
  </code></pre>
  
  <p>Whats wrong here? Is it false positive or I miss something?</p>
  
  <p>This code also produces warning IDE0059 in VS2019:</p>
  
  <pre><code>private static XmlDocument LoadXmlFromFile(string xmlPath)
      {
          XmlDocument doc = new XmlDocument();
          int i = 2;
          while (true)
          {
              try
              {
                  using (Stream fileStream = File.Open(xmlPath, FileMode.Open, FileAccess.Read, FileShare.None))
                  {
                      doc.Load(fileStream);
                  }
  
                  return doc;
              }
              catch (IOException)
              {
                  if (i == 0)
                  {
                      throw;
                  }
                  i--;
                  Thread.Sleep(100);
              }
          }
      }
  </code></pre>