The Wayback Machine - https://web.archive.org/web/20220121224133/https://github.com/dotnet/aspnetcore/issues/39691
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Razor: <partial>as direct child of @if does does compile #39691

Open
vsfeedback opened this issue Jan 21, 2022 · 0 comments
Open

Razor: <partial>as direct child of @if does does compile #39691

vsfeedback opened this issue Jan 21, 2022 · 0 comments

Comments

@vsfeedback
Copy link

@vsfeedback vsfeedback commented Jan 21, 2022

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]

in a .cshtml razor file

1 @if (true)
2 {
3   <partial /> // compiles 
4   <span><partial></span> // compiles 
5   <partial></partial> // compiles 
6   <partial> // does not compile 
7 }

The self-closing tag behavior is inconsistent with conventions. The compiler generates the RZ1006 AND RZ1025 error code indicating that self-closing tag may not be used implicitly. But HTML5 conventions indicate that the self-closing syntax "/>" may be omitted for void tags (those not having any body). However, the actual behavior is that self-closing syntax may be omitted when the node is a direct child of a markup node, but not when it's a direct child of a logic node.

In my opinion, either lines 4 and 6 should both compile, or both should generate the same warning.


Original Comments

Feedback Bot on 1/11/2022, 10:12 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 1/11/2022, 11:26 PM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.

Seth Ficke on 1/12/2022, 06:04 AM:

(private comment, text removed)


Original Solutions

(no solutions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants