No closing bracket notificationhttp://forums.asp.net/t/1755000.aspx/1?No+closing+bracket+notificationThu, 05 Jan 2012 20:02:49 -050017550004760097http://forums.asp.net/p/1755000/4760097.aspx/1?No+closing+bracket+notificationNo closing bracket notification <p>Hi,</p> <p>As a developer I would like to point out some kind of error/missing feature&nbsp;when using the razor engine. It took me quite some time to locate the exact position of the ommitted bracket and I would like to point this out to other developers so they can either pay close attention to it or even find/create some fix.</p> <p>In the visual studio environment, no notification is given when one forgets to place a curly bracket at the end of html attributes included within a certain htmlhelper.</p> <p>for example:</p> <p>&nbsp;</p> <pre style="background:white; color:black; font-family:Consolas"><span style="color:blue">&lt;</span><span style="color:maroon">div</span>&nbsp;<span style="color:red">id</span><span style="color:blue">=</span><span style="color:blue">&quot;divStatus&quot;</span>&nbsp;<span style="color:red">class</span><span style="color:blue">=</span><span style="color:blue">&quot;elementsearch&quot;</span><span style="color:blue">&gt;</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue">&lt;</span><span style="color:maroon">label</span>&nbsp;<span style="color:red">id</span><span style="color:blue">=</span><span style="color:blue">&quot;lblStatus&quot;</span>&nbsp;<span style="color:red">class</span><span style="color:blue">=</span><span style="color:blue">&quot;leftelementsearch&quot;</span><span style="color:blue">&gt;</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background:yellow">@</span>Html.LabelFor(model&nbsp;=&gt;&nbsp;model.Status)<span style="color:blue">&lt;/</span><span style="color:maroon">label</span><span style="color:blue">&gt;</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue">&lt;</span><span style="color:maroon">div</span>&nbsp;<span style="color:red">class</span><span style="color:blue">=</span><span style="color:blue">&quot;rightelementsearch&quot;</span><span style="color:blue">&gt;</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background:yellow">@</span>Html.DropDownListFor(model&nbsp;=&gt;&nbsp;model.Status,&nbsp;<span style="color:blue">new</span>&nbsp;<span style="color:#2b91af">SelectList</span>(Model.PropertiesList.Statusses,&nbsp;<br> <span style="color:#a31515">&quot;Value&quot;</span>,&nbsp;<span style="color:#a31515">&quot;Text&quot;</span>,&nbsp;Model.Status),&nbsp;<span style="color:#a31515">&quot;--&nbsp;&quot;</span>&nbsp;&#43;&nbsp;@Resources.Properties.<span style="color:#2b91af">CloseClient</span>.SelectStatus&nbsp;&#43;&nbsp;<br> <span style="color:#a31515">&quot;&nbsp;--&quot;</span>,&nbsp;<span style="color:blue">new</span>&nbsp;{&nbsp;@class&nbsp;=&nbsp;<span style="color:#a31515">&quot;col1search&quot;</span>&nbsp;) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="background:yellow">@</span>Html.ValidationMessageFor(model&nbsp;=&gt;&nbsp;model.Status) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue">&lt;/</span><span style="color:maroon">div</span><span style="color:blue">&gt;</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue">&lt;/</span><span style="color:maroon">div</span><span style="color:blue">&gt;</span></pre> <pre style="background:white; color:black; font-family:Consolas"><span style="color:blue"></span></pre> <p>In the example above, it isn't that cumbersome to find the ommitted bracket at the end of the html attributes. But when you should forget that simple curl before closing the parameterlist, the application will compile/build/... and it can run. Only when the page is shown, the error is thrown that you have typed a curly bracket where there shouldn't be one. The error will occur at the following line (which isn't the actual errorline, but is at the end of the generated html-page generator class, that is in it's turn generated by ASP.Net):</p> <p>WriteLiteral(&quot;&lt;/div&gt;\r\n&quot;);</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; }<br> }</p> <p>&nbsp;</p> <p>Since none of us actually wrote the generator for this html code, it can be quite cumbersome as to find the actual error, especially when you are using nested views. The search for the opening curly bracket is a real pain and a simple build-error would fix the problem in an instant.</p> <p>&nbsp;</p> <p>So I would like to ask/suggest to include this in the parser included with mvc4.</p> <p>Thanks in advance,</p> <p>If you have any remarks or similar experiences, do let me know. Such simple problems shouldn't take so long to be found.</p> 2012-01-02T12:26:51-05:004767384http://forums.asp.net/p/1755000/4767384.aspx/1?Re+No+closing+bracket+notificationRe: No closing bracket notification <p>you can report a bug in here:</p> <p>https://connect.microsoft.com/VisualStudio/</p> <p></p> 2012-01-05T20:02:49-05:00