Repository navigation
Closed
Description
Template engine can throw many unexpected exceptions when compiling or rendering templates (I assume that the expected exception type is HandlebarsException). Here are the types of exceptions it can throw, the code snippets used to trigger them, and the stack traces:
ArgumentException
HandlebarsDotNet.Handlebars.Compile("{{p=\np=}}")(new object());Exception has occurred: CLR/System.ArgumentException
An unhandled exception of type 'System.ArgumentException' occurred in System.Private.CoreLib.dll: 'An item with the same key has already been added. Key: p'
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException[T](T key)
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at HandlebarsDotNet.Compiler.HashParametersConverter.AccumulateParameters(IEnumerator`1 enumerator)
at HandlebarsDotNet.Compiler.HashParametersConverter.<ConvertTokens>d__2.MoveNext()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at HandlebarsDotNet.Compiler.ExpressionBuilder.ConvertTokensToExpressions(IEnumerable`1 tokens)
at HandlebarsDotNet.Compiler.HandlebarsCompiler.Compile(TextReader source)
at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.Compile(String template)
InvalidCastException
HandlebarsDotNet.Handlebars.Compile("{{>r=}}")(new object());Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'HandlebarsDotNet.Compiler.HashParameterDictionary' to type 'System.String'.
at lambda_method(Closure , TextWriter , Object )
at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.<>c__DisplayClass7_0.<Compile>b__0(Object context)
InvalidOperationException
HandlebarsDotNet.Handlebars.Compile("{{0")(new object());Exception has occurred: CLR/System.InvalidOperationException
An unhandled exception of type 'System.InvalidOperationException' occurred in Handlebars.dll: 'Reached end of template before the expression was closed.'
at HandlebarsDotNet.Compiler.Lexer.LiteralParser.AccumulateLiteral(TextReader reader, Boolean captureDelimiter, Char[] delimiters)
at HandlebarsDotNet.Compiler.Lexer.LiteralParser.Parse(TextReader reader)
at HandlebarsDotNet.Compiler.Lexer.Tokenizer.<Parse>d__8.MoveNext()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at HandlebarsDotNet.Compiler.HandlebarsCompiler.Compile(TextReader source)
at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.Compile(String template)
NullReferenceException
HandlebarsDotNet.Handlebars.Compile("{{@..}}")(new object());Exception has occurred: CLR/System.NullReferenceException
An unhandled exception of type 'System.NullReferenceException' occurred in Handlebars.dll: 'Object reference not set to an instance of an object.'
at HandlebarsDotNet.Compiler.PathBinder.ResolvePath(BindingContext context, String path)
at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.<>c__DisplayClass7_0.<Compile>b__0(Object context)
Found via SharpFuzz.
Metadata
Metadata
Assignees
Labels
No labels
Activity