Skip to content

Removed extensibility for DefaultHttpContext #14771

Closed
@JamesNK

Description

@JamesNK

Removed extensibility for DefaultHttpContext

As part of performance improvements made to ASP.NET Core 3.0 (dotnet/aspnetcore#6504), we've removed the extensibility of DefaultHttpContext (it is now sealed). This extensibility was provided initially to allow pooling of the HttpContext but it introduced more complexity than necessary and precluded other optimizations. As a result, we decided to remove this extensibility.

If you're using Mock<DefaultHttpContext> in your unit tests, we recommend using Mock<HttpContext> instead.

Please discuss this on dotnet/aspnetcore#6534

Version introduced

3.0

Old behavior

DefaultHttpContext could be inherited from.

New behavior

DefaultHttpContext is sealed.

Reason for change

Extensibility introduced more complexity than necessary and precluded other optimizations. As a result, we decided to remove this extensibility.

Recommended action

If you're using Mock<DefaultHttpContext> in your unit tests, we recommend using Mock<HttpContext> instead.

Category

  • ASP.NET Core

Affected APIs

DefaultHttpContext


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

Labels

breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions