Noticed a few of this lurking around in my teams code base recently, very easy to go unnoticed. Without HTML Validation, anyway.
- @helper MyHelper(string foo)
- {
- //Good
- @foo
- //Not ‘bad’, just not required as the @foo will just render out. <text></text> is only needed when Razor can’t auto-detect
- <text>@foo</text>
- }
- <div>
- @* Good *@
- @MyHelper(“Some Nice Message”)
- @*Bad – The <text></text> gets rendered as HTML to the browser*@
- <text>@MyHelper(“Some Nice Message”)</text>
- </div>