title: Debugging runtime of XmlProvider
body: <p>I attached a the XmlProvider to what seems to be a valid xml (displays in IE, is validated by W3C tool)</p>
  
  <p>When I write the program, everything type checks and I can compile.
  However at runtime I have the following error: </p>
  
  <pre><code>Data at the root level is invalid. Line 1, position 1.
  </code></pre>
  
  <p>When I access </p>
  
  <pre><code>  let posts = (TyPosts.Parse lastposts).GetEntries()
  </code></pre>
  
  <p>Where entry is a node name.</p>
  
  <p>=> where should I place a breakpoint ?</p>
  
  <p>I can only managed to break on the TP construction, not on its actual data access !</p>
  
  <p>To reproduce the initial pb, here is a script. the only modif should be the 2 first dlls.</p>
  
  <pre><code>#r @"Z:\clones\FSharp.Data\bin\v40\FSharp.Data.dll"
  #r @"Z:\clones\FSharp.Data\bin\v40\FSharp.Data.DesignTime.dll"
  #r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll"
  #r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll"
  #r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Net.dll"
  #r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Net.Http.dll"
  #r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll"
  #r @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll"
  open System
  open System.Net
  open FSharp.Data
  open System.IO;
  open System.Text;
  open System.Xml;
  [&lt;Literal&gt;] 
  let lastposts = "lastposts.xml" 
  let phase0 () =
    let fetch (url : string, auth) =
     use client = new WebClient()
     client.Headers.Add("user-agent", @"Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US")
     client.DownloadString url
    let write(filename, content:string) = 
       use f= new StreamWriter(filename, false)
       f.Write(content)
    let posts () = fetch(@"http://squarism.com/feed/atom/", false)
    write(  __SOURCE_DIRECTORY__   + "/"+ lastposts, posts())
  phase0()
  
  [&lt;Literal&gt;]
  let res = __SOURCE_DIRECTORY__
  type TyPosts = XmlProvider&lt;lastposts,ResolutionFolder=res&gt; 
  let posts = (TyPosts.Parse lastposts).GetEntries() // &lt;-- TCHETCHENIA HERE !!
  </code></pre>