Description
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
Issue metadata
- Issue type: breaking-change