简体   繁体   中英

C# handlebars error in Handlebars.Compile() function

I am trying to use handlebars with C# in universal windows platform (UWP) using Handlebars.Net in this GitHub link ( https://github.com/Handlebars-Net/Handlebars.Net )

I used simple code used in the usage section in the link above and even though it didn't work always stop at handlebars.compile() function and throws error.

My code is a very basic simple one just when I press a button in the application, I enter debug mode to see the result but I got this exception message.

This is the error message.

错误信息

完全异常错误

and this is the code I used.

    try
    {
        string source = "{{title}} and This Is body : {{body}}";

        var template = Handlebars.Compile(source);

        var data = new
        {
            title = "My new post",
            body = "This is my first post!"
        };

        var result = template(data);

    }
    catch (Exception ex)
    {
        throw new Exception(ex.Message);
    }

I tried installing Linq express and Linq itself but nothing changed.

Handlebars.Net uses Expression Trees to compile templates. MissingMethodException means that platform you're trying to compile the template on does not support required Expression Trees features. It's known issue on iOS. I may assume that the same might be true for UWP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM