OutOfMemoryException on unrecognised template
anth12 opened this issue · comments
Anthony Halliday commented
Describe the bug
When attempting to compile a template that is unrecognised, the thread is blocked and eventually throws an OutOfMemoryException.
Expected behaviour:
The template parsing should either ignore the unsupported syntax or throw an "unsupported exception".
Test to reproduce
[Fact]
public void Compile_UnrecognisedExpression_ThrowsOutOfMemory()
{
var handlebars = Handlebars.Create();
var source = "{{Text | example}}";
Assert.Throws<OutOfMemoryException>(()=> handlebars.Compile(source));
}
Other related info
My use-case for a templating library is to render HTML emails where templates are maintained by content editors. The above syntax is used by SendGrid to default values hence it's usage with Handlebars.Net.