刚开始nvelocity(v1.1.1),它似乎工作得很好。

只有一件小事让我烦恼。我已经设置了VS2010,每次抛出异常时,即使它在某处处理,并且在运行以下代码时,它始终会在呼叫中删除,以评估,陈述它“无法从关闭的textreader读取”(ObjectDispostException))。我没有nvelocity的源代码,所以我无法调试。

我缺少某个地方的设置吗?是nvelocity的无害错误吗?结果很好,对我来说,它看起来不太正确。

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();
}
.

异常堆栈跟踪:

在system.io .__错误.Readerclosed()AT system.io.StringReader.read(Char []缓冲区,INT32索引,INT32计数)
在nvelocity.runtime.parser.velocityCharStream.fillbuff() C:\ ... \ src \ nvelocity \ Runtime \ Parser \ VelocityCharStream.cs:Line 313

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top