Razor in MVC has a bug when parsing HTML comments with an apostrophe in them. The engine throws an "Expected }" exception.
Below is an example on how to reproduce this issue in the default MVC 4 application with VS 2012. Just add the following a comment with an apostrophe to the @section featured {} in the default.cshtml. Remove the apostrophe from the comment and it works OK.
@section featured {
<!-- hello world it's not cool -->
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
<p>...</p>
</div>
</section>
}
http://stackoverflow.com/a/13864352/446681
Comments: Yeurch - Reverified this is actually resolves 933 as well. Unit tests have been checked in and we verified as follows in VS2013: New MVC5 project Add image with src="~/something" Make sure the image renders Do the same with <!-- ' --> above the image tag. Make sure the image renders.
Below is an example on how to reproduce this issue in the default MVC 4 application with VS 2012. Just add the following a comment with an apostrophe to the @section featured {} in the default.cshtml. Remove the apostrophe from the comment and it works OK.
@section featured {
<!-- hello world it's not cool -->
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1>@ViewBag.Title.</h1>
<h2>@ViewBag.Message</h2>
</hgroup>
<p>...</p>
</div>
</section>
}
http://stackoverflow.com/a/13864352/446681
Comments: Yeurch - Reverified this is actually resolves 933 as well. Unit tests have been checked in and we verified as follows in VS2013: New MVC5 project Add image with src="~/something" Make sure the image renders Do the same with <!-- ' --> above the image tag. Make sure the image renders.