You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Template.Render can sometimes throw InvalidCastException when rendering template that doesn't have any errors (HasErrors property returns false). Here's the full program that reproduces this:
namespace Scriban.Run
{publicclassProgram{publicstaticvoidMain(string[]args){vartemplate= Template.ParseLiquid("{{html>0}}");
template.Render(new{ x =0});}}}
And here's the full stack trace:
Exception has occurred: CLR/System.InvalidCastException
An unhandled exception of type 'System.InvalidCastException' occurred in System.Private.CoreLib.dll: 'Unable to cast object of type 'Scriban.Functions.HtmlFunctions' to type 'System.IConvertible'.'
at System.Convert.ToInt32(Object value, IFormatProvider provider)
at Scriban.TemplateContext.ToInt(SourceSpan span, Object value)
at Scriban.TemplateContext.ToObject(SourceSpan span, Object value, Type destinationType)
at Scriban.Syntax.ScriptBinaryExpression.CalculateOthers(TemplateContext context, SourceSpan span, ScriptBinaryOperator op, Object leftValue, Object rightValue)
at Scriban.Syntax.ScriptBinaryExpression.Evaluate(TemplateContext context, SourceSpan span, ScriptBinaryOperator op, Object leftValue, Object rightValue)
at Scriban.Syntax.ScriptBinaryExpression.Evaluate(TemplateContext context)
at Scriban.TemplateContext.Evaluate(ScriptNode scriptNode, Boolean aliasReturnedFunction)
at Scriban.Syntax.ScriptExpressionStatement.Evaluate(TemplateContext context)
at Scriban.TemplateContext.Evaluate(ScriptNode scriptNode, Boolean aliasReturnedFunction)
at Scriban.Syntax.ScriptBlockStatement.Evaluate(TemplateContext context)
at Scriban.TemplateContext.Evaluate(ScriptNode scriptNode, Boolean aliasReturnedFunction)
at Scriban.TemplateContext.Evaluate(ScriptNode scriptNode, Boolean aliasReturnedFunction)
at Scriban.Template.EvaluateAndRender(TemplateContext context, Boolean render)
at Scriban.Template.Render(TemplateContext context)
at Scriban.Template.Render(Object model, MemberRenamerDelegate memberRenamer, MemberFilterDelegate memberFilter)
I'm using .NET Core 2.2 and the latest NuGet alpha version of Scriban (2.0.0-alpha-005).
Template.Render can sometimes throw InvalidCastException when rendering template that doesn't have any errors (HasErrors property returns false). Here's the full program that reproduces this:
And here's the full stack trace:
I'm using .NET Core 2.2 and the latest NuGet alpha version of Scriban (2.0.0-alpha-005).
Found via SharpFuzz.
The text was updated successfully, but these errors were encountered: