Networking breaking changes in .NET Core 2.0 and 3.0

The following breaking changes are documented on this page:

Breaking change Introduced version
Default value of HttpRequestMessage.Version changed to 1.1 3.0
WebClient.CancelAsync doesn't always cancel immediately 2.0

.NET Core 3.0

Default value of HttpRequestMessage.Version changed to 1.1

The default value of the System.Net.Http.HttpRequestMessage.Version property has changed from 2.0 to 1.1.

Version introduced

3.0

Change description

In .NET Core 1.0 through 2.0, the default value of the System.Net.Http.HttpRequestMessage.Version property is 1.1. Starting with .NET Core 2.1, it was changed to 2.1.

Starting with .NET Core 3.0, the default version number returned by the System.Net.Http.HttpRequestMessage.Version property is once again 1.1.

Update your code if it depends on the System.Net.Http.HttpRequestMessage.Version property returning a default value of 2.0.

Category

Networking

Affected APIs


.NET Core 2.0

WebClient.CancelAsync doesn't always cancel immediately

Starting in .NET Core 2.0, calling WebClient.CancelAsync() doesn't cancel the request immediately if the response has started to fetch.

Change description

Previously, calling WebClient.CancelAsync() canceled the request immediately. Starting in .NET Core 2.0, calling WebClient.CancelAsync() cancels the request immediately only if the response hasn't started fetching. If the response has started to fetch, the request is cancelled only after a complete response is read.

This change was implemented because the WebClient API is deprecated in favor of HttpClient.

Version introduced

2.0

Use the System.Net.Http.HttpClient class instead of System.Net.WebClient, which is deprecated.

Category

Networking

Affected APIs