ASP.NET: How to correctly comment markup code
produced the following exception
In order to analyze the problem I started with commenting the codeline in question like this
Well – unfortunately that is not the way to comment source code in your markup file. This markup code gets compiled into the temporary .NET Assembly like this
Even though the output of my HtmlHelper call will be under comments in the final HTML – the method is still called – causing the same exception to happen.
To do this right – you have to comment the code within the code block like this
Makes sense? Yes – it does. But if you don’t know it you may be surprised about the result.