Blazor local functions in ChildContent don't work correctly
Open
Area-Razor
Area-Razor-Compiler
Bug
Investigation Required
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
When I call local functions in @{} block inside a .razor component tag the content from the local function isn't getting rendered.
Home.razor
```razor
@page "/"
Issue showcase
Hello 1
@{
IssueLocalFunction();
}
@{
void IssueLocalFunction()
{
Hello 2
}
}
```
IssueComponent.razor
```razor
@ChildContent
@code {
[Parameter]
public RenderFragment? ChildContent { get; set; }
}
```
Output

It's getting showed when is prerendering but then it disappears.
Here is my repo with that issue:
https://github.com/EngieDev/BlazorComponentsIssue
Contributor guide
Assessment
This issue has not been assessed yet.