dotnet / dotnet/aspnetcore

Unclear error message when nesting Counter Control inside html paragraph tags

Open
#54,510 2 comments 0 reactions 0 assignees View on GitHub
area-blazor enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Blazor .net 8, SSR project as default.

When you place the Counter component inside the html p tag, you will get the following exception:

blazor.web.js:1 Uncaught Error: Found malformed component comment at Blazor:{"type":"server","prerenderId":"d78c1b969b5a4f0b97a2f182d189d822","key":{"locationHash":"201FE61663F0F29A3282826AFE151DBE7E9AE7D8DE326FD522C7EAF3415AAE26:8","formattedComponentKey":"1"},"sequence":0,"descriptor":"CfDJ8AWdFPKemF1LvFLRlJ/JxoYui6cratQf5GN37sLmRrBxTIc76mIsYRiSVx34rD5UnMWRhCi901bdhLYSBR8PG9qaC4qzFDq/NzS8TvFnkIhcUpaW5z8RBEpjhuPxgpFErdy5tC/yTJE9wXSDoWPJjU0VYBAuW2ioloJGUGHkP/TYe3B5P7GD3zZ979HCErSo4WcIvQWHYhihwUObnE2mBYSxXGY\u002B4XGosPqd4DLik7ILsOLXFZ13GVdU0YCpkXyDvyIpqejXp/D1b\u002B5jfsVii5xYpSEAiyYZUju8e1lfNdj7SumX6frCYu8PW0c6ercqwipkqrUPT6CbnvAc62vrhqA0M6mxpPUY1q4AiS9b9kAzlBZpUQjAmT73BaslZ\u002B1ONHDHf/P8saxmLEm6suQ8loeVc\u002BmfITKWt6YyOJb\u002BEv4KbSjFluR4qMQ9jqGNUXBVVnVkKr3t/1smwHcAfP0IIs0gipc\u002BDUEe5PI45fo4HyB\u002BFY5r0EwQXsi//a7z8lyHa5eFAoeZsr3RGcMIxwq1MQ4hqx75xo\u002B14qMLTFvP7lbdOY/fX6bD1EHHNNi5J1RA8c3d9hbNRxFjHVgJ9SDghliVCKcDW4CWt4UIdypGqxal4e67lZGpdMILx6MR3XmNvhksdKMkTdIRq5gCO7aZPIPREO3Kyw3Z5BJofyiAgKxUmr2ZXkAqwYlABQWXGg6Xd7vN\u002B8hA4JJ7Ik48ydWjelNoQGbqLheN1owRThL5/q7KH/U6k\u002BSaosiv2lmjZrGLv0sxXWrHAiY71qgyCe5JJq8egUFhCbmE3lZvOfbbNMFHwEyM9QnOTrJWNp/nttlF6o1Dqcxe0xrQcsbf\u002BzHplCnHV0YMNOk9/v3g20Wu55CRiFvKqmirxro8/84jw8qfGqWLEVx0StEmLvxyBLR/TioAHqurGfzFccQOSP0DsrBg7\u002B7V8kMf\u002Bs6a1n5ge3POZT2sDsqGwNY1E8uHrxtimWzxKa\u002B2teqOnR7bPfyzO7Dp7R9TC8ywj7EbuxxelQQcLY3yPwI/BHGbyEcYjc0Zy300CGde/J4lNMK6Gb02Q0o481t\u002BEyLN\u002BLqukucRDFOYIWILWF6ST0df3SuSbvrIcPJyszWoSFUvjr5IOKVnfrvMh4TgOFmmzdln5uaXpFX3dvZ\u002BOBS1v0Z7wi0BuoU51O050bLPgcd3sCLc8mtpKnthV/n9uh9TNtaFV1qR0cJv4RomoPBtD5elCCGfb7r1qkmNx2jUExXsP41euyR86B/O"}

Code Example that produces this exception:

`


`

But this is okay

`


`

Also this okay:

``

This is also fine:

`


`

Clearly, something is going on. I should be able to place components inside paragraph tags.

**Other findings:**
- I stripped the Counter's component content to just displaying h1 tag with some text and that made no difference
- Removing "@rendermode" attribute from the Counter component resolves that problem ... So this issues is obviously with server side DOM updates/rendering.

I hope this helps

### Expected Behavior

_No response_

### Steps To Reproduce

_No response_

### Exceptions (if any)

Exception is in the problem description.

### .NET Version

.net 8 Blazor

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.