Open Joebeazelman opened 4 years ago
@Joebeazelman Thanks for contacting us.
@NTaylorMullen @ajaybhargavb Is this supproted in Razor in the middle of a tag?
@NTaylorMullen if this turns out something we need to fix or add support for, we'll consider that for 5.0 timeframe.
It may well be an existing issue with razor, but I can't think of a single case where block comments are interpreted in other mainstream programming languages.
Seeing as you are inside html the moment you write <
, have you tried using html comment notation instead?
Confirmed this still repros.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
This is still an issue in .NET 7, at least for Blazor:
Trying to run the above code anyway results in this error:
Failed to execute '
setAttribute
' on 'Element
': '@* @ref="mnuIdref" *@
' is not a valid attribute name.
@333fred It looks like we're incorrectly parsing here, we find the comment, but wrap it in an attribute:
That then means when we emit, we're emitting it as an attribute to the component.
we find the comment, but wrap it in an attribute
This doesn't surprise me, given that the parser doesn't use leading or trailing trivia; I'm guessing this won't be easy to fix without doing that.
5 years later this is still an issue, and i wasted few hours on it, learning Blazor. And must be very common issue, as this is how visual studio comments in razor by default... Cmon people
I tried to comment out the attribute using the razor comment syntax:
Upon execution, it interpreted the commented area as regular Blazor code: