Skip to content

Blazor IDisposable not working #39953

@rborosak

Description

@rborosak

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

IDisposable is not working when the component implements both IDisposable and IAsyncDisposable.

Based on the empty Blazor Server project

public partial class Counter : IDisposable, IAsyncDisposable
{
public void Dispose() {}
public ValueTask DisposeAsync(){ return ValueTask.CompletedTask; }
}

Only DisposeAsync method is called.

Expected Behavior

Both Dispose and DisposeAsync should be called.

.NET Version

.NET 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor Componentsfeature-renderingFeatures dealing with how blazor renders componentsquestion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions