Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues using Dynamic Partials #324

Closed
joamla96 opened this issue Nov 26, 2019 · 0 comments
Closed

Issues using Dynamic Partials #324

joamla96 opened this issue Nov 26, 2019 · 0 comments
Labels

Comments

@joamla96
Copy link

joamla96 commented Nov 26, 2019

Hello.
I'm trying to implement a "Dynamic Partial", how-ever I encounter this exception:¨

   at System.Reflection.RuntimeMethodInfo.CreateDelegateInternal(Type delegateType, Object firstArgument, DelegateBindingFlags bindingFlags)
   at HandlebarsDotNet.Compiler.SubExpressionVisitor.GetHelperDelegateFromMethodCallExpression(MethodCallExpression helperCall)
   at HandlebarsDotNet.Compiler.SubExpressionVisitor.VisitSubExpression(SubExpressionExpression subex)
   at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node)
   at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor visitor)
   at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)
   at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
   at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
   at System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block)
   at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node)
   at System.Linq.Expressions.BlockExpression.Accept(ExpressionVisitor visitor)
   at HandlebarsDotNet.Compiler.FunctionBuilder.Compile(IEnumerable`1 expressions, Expression parentContext, String templatePath)
   --- End of inner exception stack trace ---
   at HandlebarsDotNet.Compiler.FunctionBuilder.Compile(IEnumerable`1 expressions, Expression parentContext, String templatePath)
   at HandlebarsDotNet.Compiler.DeferredSectionVisitor.GetDeferredSectionTemplates(DeferredSectionExpression dsex)
   at HandlebarsDotNet.Compiler.DeferredSectionVisitor.VisitDeferredSectionExpression(DeferredSectionExpression dsex)
   at System.Dynamic.Utils.ExpressionVisitorUtils.VisitBlockExpressions(ExpressionVisitor visitor, BlockExpression block)
   at System.Linq.Expressions.ExpressionVisitor.VisitBlock(BlockExpression node)
   at System.Linq.Expressions.BlockExpression.Accept(ExpressionVisitor visitor)
   at HandlebarsDotNet.Compiler.FunctionBuilder.Compile(IEnumerable`1 expressions, Expression parentContext, String templatePath)
   --- End of inner exception stack trace ---
   at HandlebarsDotNet.Compiler.FunctionBuilder.Compile(IEnumerable`1 expressions, Expression parentContext, String templatePath)
   at HandlebarsDotNet.Compiler.FunctionBuilder.Compile(IEnumerable`1 expressions, String templatePath)
   --- End of inner exception stack trace ---
   at HandlebarsDotNet.Compiler.FunctionBuilder.Compile(IEnumerable`1 expressions, String templatePath)
   at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.Compile(String template)
   at FileGeneratorService.Service.GeneratePDF(VM_Quote quote) in D:\Users\jola\Source\Repos\Utility Portal\FileGeneratorService\Service.cs:line 63
   at WebAPI.Controllers.QuotesController.GetExport(Int32 id, String type) in D:\Users\jola\Source\Repos\Utility Portal\WebAPI\Controllers\QuotesController.cs:line 291
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at WebAPI.MiddlewareDeveloperException.Invoke(HttpContext context) in D:\Users\jola\Source\Repos\Utility Portal\WebAPI\MiddlewareDeveloperException.cs:line 23

I've registered the following templates and verified they work independently.

Handlebars.RegisterTemplate("ProductGroups", await productGroupTask);
Handlebars.RegisterTemplate("ProductGroupsTypeA", await productGroupIaasTask);

and a helper that looks like this:
(obviously, this part is not done yet, but should still work)

Handlebars.RegisterHelper("WhichProductGroup", (output, context, arguments) => {
	output.Write("ProductGroups");
});

and finally, this is how I'm trying to use it:

{{#productGroups}}
{{> (WhichProductGroup)}}
{{/productGroups}}

Any chance you can see what i missed?
I was using information from issue #96 as a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants