Describe the bug
Trying to enumerate an array via a nested object path:
{{#bundles.styles.vendor}}{{this}}{{/bundles.styles.vendor}}
Results in an IndexOutOfRangeException exception.
Expected behavior:
I would expect the same result as when not using a nested path, i.e.
Or, alternatively, if this is not supported: a clearer exception message.
Test to reproduce
var context = new
{
bundles = new
{
styles = new
{
vendor = new[] { "a", "b", "c" }
}
},
arr = new[] { "d", "e", "f"}
};
// Works: Output = "abc"
Handlebars.Compile("{{#each bundles.styles.vendor}}{{this}}{{/each}}")(context).Dump();
// Works: Output = "def"
Handlebars.Compile("{{#arr}}{{this}}{{/arr}}")(context).Dump();
// Fails: IndexOutOfRangeException in HandlebarsDotNet.PathStructure.PathResolver.ResolvePath
// On line #36: if (!TryResolveValue(pathInfo.IsVariable, context, pathChain[0], instance, out instance))
Handlebars.Compile("{{#bundles.styles.vendor}}{{this}}{{/bundles.styles.vendor}}")(context).Dump();```