Skip to content

Using Handlebars.Net in a Blazor WASM throws error when using ".Compile()" #345

Description

@StefH

This is because the WASM linker removes some of the "Expression" code. For a solution, see zzzprojects/System.Linq.Dynamic.Core#360

Or I can also make a PR for this project.

Full Exception:

HandlebarsDotNet.HandlebarsCompilerException: An unhandled exception occurred while trying to compile the template ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Reflection.Emit.ILGenerator.Emit (System.Reflection.Emit.OpCode opcode, System.Reflection.ConstructorInfo con) <0x2334fc0 + 0x00042> in :0 at System.Linq.Expressions.Compiler.CompilerScope.EmitNewHoistedLocals (System.Linq.Expressions.Compiler.LambdaCompiler lc) <0x231a968 + 0x0024e> in :0 at System.Linq.Expressions.Compiler.CompilerScope.Enter (System.Linq.Expressions.Compiler.LambdaCompiler lc, System.Linq.Expressions.Compiler.CompilerScope parent) <0x2307628 + 0x00048> in :0 at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody (System.Linq.Expressions.Compiler.CompilerScope parent, System.Boolean inlined, System.Linq.Expressions.Compiler.LambdaCompiler+CompilationFlags flags) <0x2307180 + 0x00012> in :0 at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody () <0x2306978 + 0x00034> in :0 at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression lambda) <0x228edf8 + 0x00026> in :0 at System.Linq.Expressions.Expression1[TDelegate].Compile (System.Boolean preferInterpretation) <0x228ea98 + 0x00002> in <filename unknown>:0 at System.Linq.Expressions.Expression1[TDelegate].Compile () <0x228e9e0 + 0x00004> in :0 at HandlebarsDotNet.Compiler.FunctionBuilder.Compile (System.Collections.Generic.IEnumerable1[T] expressions, System.String templatePath) <0x2227300 + 0x0001c> in <filename unknown>:0 --- End of inner exception stack trace --- at HandlebarsDotNet.Compiler.FunctionBuilder.Compile (System.Collections.Generic.IEnumerable1[T] expressions, System.String templatePath) <0x2227300 + 0x0003e> in :0 at HandlebarsDotNet.Compiler.HandlebarsCompiler.Compile (System.IO.TextReader source) <0x21dd428 + 0x00048> in :0 at HandlebarsDotNet.Handlebars+HandlebarsEnvironment.Compile (System.IO.TextReader template) <0x21dd1e8 + 0x0000e> in :0 at HandlebarsDotNet.Handlebars+HandlebarsEnvironment.Compile (System.String template) <0x21dd008 + 0x00026> in :0 at BlazorApp1.Pages.Index.OnInitialized () <0x212a288 + 0x001d0> in :0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions