title: NVelocity: "Cannot read from a closed TextReader"
body: <p>Just getting started on NVelocity (v1.1.1) and it seems to be working just fine.</p>
  
  <p>There's just one small thing that annoys me. I've set up VS2010 to break each time an exception is thrown even though it gets handled somewhere, and when running the following code, it always breaks at the call to Evaluate, stating that it "Cannot read from a closed TextReader" (ObjectDisposedException). I do not have the source code for NVelocity, so I cannot debug.</p>
  
  <p>Am I missing a setting somewhere that causes this? Is it just a harmless bug in NVelocity? The result comes out fine, to me it just seems like something's not quite right.</p>
  
  <pre><code>var velocity = new VelocityEngine();
  var properties = new ExtendedProperties();
  var context = new VelocityContext(fieldValues);
  properties.AddProperty("velocimacro.library", string.Empty); // no library
  velocity.Init(properties);
  
  using (var writer = new StringWriter())
  {
    velocity.Evaluate(context, writer, null, templateContents);
    return writer.ToString();
  }
  </code></pre>
  
  <p>Exception stack trace:</p>
  
  <blockquote>
    <p>at System.IO.__Error.ReaderClosed()    at
    System.IO.StringReader.Read(Char[] buffer, Int32 index, Int32 count)<br>
    at NVelocity.Runtime.Parser.VelocityCharStream.FillBuff() in 
    c:\...\src\NVelocity\Runtime\Parser\VelocityCharStream.cs:line 313</p>
  </blockquote>