title: The process cannot access the file error with System.Web.UI.DataVisualization.Charting
body: <p>I use charts from System.Web.DataVisualization.</p>
  
  <pre><code>&lt;%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %&gt;
  ...
  &lt;asp:Chart ImageType="Png" runat="server" ID="chartStatComp" Palette="BrightPastel"
      ImageLocation="~/CRM/Reports/chartStatComp_#SEQ(100,10)" ImageStorageMode="UseImageLocation"
      Width="620" Height="300"&gt;
      &lt;ChartAreas&gt;
          &lt;asp:ChartArea Name="MainChartArea"&gt;
          &lt;/asp:ChartArea&gt;
      &lt;/ChartAreas&gt;
      &lt;Series&gt;
          &lt;asp:Series ChartArea="MainChartArea" ChartType="Pie" XValueType="String" YValueType="Int32"
              CustomProperties="DoughnutRadius=25, PieDrawingStyle=Concave, CollectedLabel=Other, MinimumRelativePieSize=20"
              XValueMember="StateDescription" YValueMembers="CNT" Legend="Legend" IsVisibleInLegend="true"
              IsValueShownAsLabel="true"&gt;
          &lt;/asp:Series&gt;
      &lt;/Series&gt;
      &lt;Legends&gt;
          &lt;asp:Legend LegendStyle="Table" Name="Legend" Alignment="Near"
              TitleAlignment="Near"&gt;
              &lt;CellColumns&gt;
                  &lt;asp:LegendCellColumn Text="Color" ColumnType="SeriesSymbol" /&gt;
                  &lt;asp:LegendCellColumn Text="#LEGENDTEXT" ColumnType="Text" Alignment="TopLeft" HeaderText="State" /&gt;
                  &lt;asp:LegendCellColumn Text="#VAL" ColumnType="Text" Name="Cnt" Alignment="TopLeft"
                      HeaderText="Count" /&gt;
                  &lt;asp:LegendCellColumn Text="#PERCENT" ColumnType="Text" Name="Percentage" Alignment="TopLeft"
                      HeaderText="%" /&gt;
              &lt;/CellColumns&gt;
          &lt;/asp:Legend&gt;
      &lt;/Legends&gt;
  &lt;/asp:Chart&gt;
  </code></pre>
  
  <p>It works well most of the time. But sometimes users gets the exception:</p>
  
  <pre><code>System.IO.IOException: The process cannot access the file '~\Reports\chartStatComp_000001.png' because it is being used by another process.
  </code></pre>
  
  <p>Its happens very rare but it does.
  Does anyone faced with similar problem?</p>