Web:UnclosedTagCheck being thrown in Razor C# Code when using generics

False positive generated while using SQ 8.4 (and default packaged plugins).

Sample code: myfile.cshtml

@model List<MyObject>

This is valid razor syntax, and throws false-positive Web:UnclosedTagCheck, stating “The tag MyObject has no corresponding closing tag.”. This is valid razor syntax.

Hello @shieldsjared,

sorry for the late response to your request. Unfortunately, this is a known problem, which has already been reported in this thread. We have created a ticket for it, which will probably be fixed during the next maintenance of the HTML analyzer.
Until then you can add your objects to the “ignoreTags” property of the rule, so it is not too noisy.

Cheers,
Nils

1 Like