title: SSIS XML Source in foreach loop container
body: <p>I've got an SSIS package with a foreach loop. The foreach loops and reads files. Filenames are put in a Variable User::FileName (index 0).</p>
  
  <p><a href="https://i.stack.imgur.com/MxJPI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MxJPI.png" alt="Forech container"></a></p>
  
  <p>My Data Flow Task is just an XML source and Ole DB Destination.</p>
  
  <p><a href="https://i.stack.imgur.com/poU5w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/poU5w.png" alt="Data Flow task"></a></p>
  
  <p>The User::Filename is passed to the XML source via "XML file from variable"</p>
  
  <p><a href="https://i.stack.imgur.com/irEwo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/irEwo.png" alt="enter image description here"></a></p>
  
  <p>I'm using the inline schema, which is valid (afaiks).</p>
  
  <p>When running the package, I get this error:</p>
  
  <blockquote>
    <p>[XML Source [50]] Error: System.Collections.Generic.KeyNotFoundException: De gegeven sleutel is niet aanwezig in het woordenboek.
       bij System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       bij Microsoft.SqlServer.Dts.Pipeline.DtsDataTableCollection.AssociateTablesWithBuffers(IDTSOutputCollection100 outputs, IDTSBufferManager100 bufferManager, Int32 localeID, DataSet dataSet)
       bij Microsoft.SqlServer.Dts.Pipeline.DtsDataTableCollection..ctor(XmlSourceAdapter xmlSourceAdapter, IDTSOutputCollection100 outputs, Int32 localeID, DataSet dataSet, IDTSBufferManager100 bufferManager)
       bij Microsoft.SqlServer.Dts.Pipeline.XmlSourceAdapter.PreExecute()
       bij Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)</p>
  </blockquote>
  
  <p>There is no TKey in my file.</p>
  
  <p>When I run this package with an xsd, no error is generated, but no rows are being read.</p>
  
  <p>When remove the foreach container and just point to a file with "inline schema" all rows are read and no error generated. However, I don't want to make a Data Flow for each file...</p>
  
  <p>I am at a loss. Could anybody help me with a solution? A way to debug this error? A general direction to search?</p>
  
  <p>Visual Studio 2010.</p>