-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Status: Resolved
Description
Describe the bug
Nesting components that make use of @bind-Value
will result in a memory leak. This occurs on both .NET Core 3.1, .NET 5.0, in both Blazor server and Blazor WASM, and on IIS Express and IIS.
To Reproduce
Create a new component BindComponent
and add this code to it:
<input type="text" class="form-control" @bind-value="Value" />
@code {
[Parameter]
public string Value
{
get => hidden;
set
{
hidden = value;
ValueChanged.InvokeAsync(value);
}
}
[Parameter]
public EventCallback<string> ValueChanged { get; set; }
private string hidden;
}
In any other component, reference the component:
<BindComponent @bind-Value="bound"></BindComponent>
@code {
string bound { get; set; }
}
Run the application and type something in the text box, then tab out. Check Visual Studio dev tools and you will see a memory leak.
I know there are ways around this issue but I doubt this should cause Blazor to leak memory.
Exceptions (if any)
Not applicable.
Further technical details
- ASP.NET Core version: .NET Core 3.1, .NET 5.0 (Blazor Server and Blazor WASM)
Metadata
Metadata
Assignees
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Status: Resolved