Antlr4BuildTasks icon indicating copy to clipboard operation
Antlr4BuildTasks copied to clipboard

WebClient is obsolete

Open flaviogrodrigues opened this issue 2 years ago • 1 comments

The Antlr4BuildTasks is still using WebClient to download java and antlr jar.

The WebClient class is marked as obsolete and generate a SYSLIB0014 warning at compile time: https://learn.microsoft.com/en-us/dotnet/core/compatibility/networking/6.0/webrequest-deprecated

Occasionally I got the following error downloading https://repo1.maven.org/maven2/org/antlr/antlr4/4.13.1/antlr4-4.13.1-complete.jar:

Problem downloading or saving probed file.

It might be related to the WebClient / SSL protocols.

Recommended action

Use the System.Net.Http.HttpClient class instead, with TLS 1.2 security protocol. I tested it locally and it seems to have solved the issue.

flaviogrodrigues avatar Nov 24 '23 10:11 flaviogrodrigues

Replaced WebClient using HttpClient calls. The Maven Central errors are caused by Maven Central being super slow. I don't think there server can handle a lot of traffic. Occasionally, we see this in the grammars-v4 builds.

kaby76 avatar Nov 24 '23 12:11 kaby76