Skip to content

Incorrect usage of ObjectDisposedException.ThrowIf in  #54143

@gurustron

Description

@gurustron

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

There is bunch of usages like ObjectDisposedException.ThrowIf(_disposed, nameof(HttpResponseStreamWriter)); while ThrowIf accepts either instance or instance of the type.

Which leads to errors like:

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.String'.
at Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)

like in this issue

Expected Behavior

Correct info about disposed type.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions