Limitations

edit

General

  • No trimming and no NativeAOT. Templates are compiled and loaded while the application runs, which needs the C# compiler and the JIT compiler.
  • No sandbox. The code of a template runs with the permissions of your application. Never compile a template written by a user of your application.
  • Templates do not compose. A template cannot include another template, and there are no layouts or partial templates: include adds a C# file. Run the templates separately and pass the text of one as an argument of another.
  • Restricted types. The types of arguments, OutputType and the base class must be public, not nested and not generic. See Passing arguments.
  • dynamic code is never unloaded. See Avoid dynamic code.
  • A built template is frozen. It cannot be loaded again or reconfigured: create a new Template.
  • Indentation is kept. The spaces in front of a statement block alone on its line are written. See Line breaks.
  • Formatting depends on the writer. Values are formatted with the culture of the writer, which is the current culture by default. See Write a value.

HTML emails

  • Only the title section is returned; the content of other sections is not available to the caller.
  • Non-ASCII characters are written as numeric character references by #html and #attr.
  • #url encodes a part of a URL, not a complete URL.
  • The library generates the HTML body only: no plain-text version, and it does not send emails or attach the images.

Command-line tool

  • Arguments passed with --arg are strings, and the arguments of a JSON file have the types of their JSON values: values of your own types cannot be passed. See Pass arguments.
  • Every template of a run receives the same arguments.
  • T4 templates are read with the syntax of the library: only the delimiters and the extension of the output directive come from T4.