title: SSIS script component buffer is not cleared
body: <p>I have very simple SSIS package which is using a Data flow inside foreachloop container to read multiple files together. The files are very simple which is having ID and Name as 2 columns.
  I am having 4 files only the data is different in each file( Id is different).
  Now I used flat file source then script component and 2 flat file destinations.
  <a href="https://i.stack.imgur.com/ulYfx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ulYfx.png" alt="My package" /></a></p>
  <p>My script component code is given below</p>
  <pre><code>using System;
  using System.Data;
  using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
  using Microsoft.SqlServer.Dts.Runtime.Wrapper;
  
  [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
  public class ScriptMain : UserComponent
  {
      static string condition = string.Empty;
  
      public override void Input0_ProcessInputRow(Input0Buffer Row)
      {
          try
          {
              if (Row.ID == &quot;4&quot;)
              {
                  condition = Row.ID;
              }
  
              Output0Buffer.AddRow();
              Output0Buffer.RowData = Row.ID + &quot;|&quot; + Row.Name;
          }
          catch (Exception ex)
          {
              bool cancel = true;  // set to true to cause execution to abort 
              ComponentMetaData.FireError(-1, &quot;Input0_ProcessInputRow()&quot;, ex.Message, &quot;&quot;, -1, out cancel);// raise the error event to SSIS
              throw ex;
          }
      }
  
      public override void Input0_ProcessInput(Input0Buffer Row)
      {
          try
          {
              base.Input0_ProcessInput(Row);
  
              //Will be true this time
              if (Row.EndOfRowset())
              {
                  if (condition == &quot;4&quot;)
                  {
                      var data = condition;
                      AOBJOutputBuffer.AddRow();
                      AOBJOutputBuffer.RowData = data;
                  }
              }
          }
          catch (Exception ex)
          {
              bool cancel = true;  // set to true to cause execution to abort 
              ComponentMetaData.FireError(-1, &quot;Input0_ProcessInputRow()&quot;, ex.Message, &quot;&quot;, -1, out cancel);// raise the error event to SSIS
              throw ex;
          }
      }
  }
  </code></pre>
  <p>What is happening is that after writing data in first file, it writes same data in next 3 files. which means that buffer is somehow not getting cleared.
  The IDs in all 4 input files are different and no Id is repeated in any file.
  The output buffer has only one column RowData which is of string type</p>
  <p>Please help me to understand this little bit.</p>