templating icon indicating copy to clipboard operation
templating copied to clipboard

Inconsistent behavior of conditions involving `boolean` parameters

Open vlada-shubina opened this issue 2 years ago • 0 comments

Template engine has 4 different expressions evaluators at the moment:

  • CPP - used for majority of language files
  • CPP2 - used for conditions inside template.json, not used in content generation.
  • MSBuild - used for conditions in MSBuild files
  • VB - used for conditions in VB

They act very differently when different syntax is used.

Details: Given boolean parameter A

  • CPP2 can process any of those syntax: if (A), if (A == true), (A == "true").
  • CPP can process those syntax: if (A), if (A == true), but not (A == "true").
  • VB can process only if (A) correctly
  • MSBuild can process if (A), if (A == true), (A == 'true'), but not (A == "true").

Note MSBuild has 2 ways to define condition as explained [here] (https://github.com/dotnet/templating/wiki/Conditional-processing-and-comment-syntax#msbuild-files).

See https://github.com/dotnet/templating/pull/5800 for more details. Consider unifying experience, and documenting it better.

vlada-shubina avatar Dec 20 '22 15:12 vlada-shubina