HTML markup breaking razor using

asp.net-mvc, asp.net-mvc-4, razor

Solution

A temporary solution would be to wrap the `<!-- -->` with `@Html.Raw("<!-- -->")` which seems to eliminate the error.

Edit: Actually the problem in your example is is the trailing three dashes `--->` on the close comment tag. Remove one of those and it works correctly.

Problem

I have this markup: ``` @using (Html.BeginRouteForm("Default", new { controller = "Home", action = "Form" }, FormMethod.Post, new { @ID="FormId", @Name="FormId"})) { <span>...</span> <div class="clearFloats"><!-- ---></div> <span>...</span> } ``` And since moving to Razor 2, MVC 4 I now get the error: The using block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup. If I remove the `<div class="clearFloats"><!-- ---></div>` code, everything is OK. I know the solution is to change these float clearing divs for a different construct of somesort, but why is it now breaking?

Original source