From 173759d554e50ec083b220f44ab9c703866ef534 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 7 Mar 2022 14:46:18 +0100 Subject: [PATCH] Fix depreciation warning about WebClient: Use HttpClient instead. --- ILSpy/AboutPage.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ILSpy/AboutPage.cs b/ILSpy/AboutPage.cs index 08d792ac0..09b14efce 100644 --- a/ILSpy/AboutPage.cs +++ b/ILSpy/AboutPage.cs @@ -20,7 +20,7 @@ using System; using System.ComponentModel; using System.IO; using System.Linq; -using System.Net; +using System.Net.Http; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; @@ -199,12 +199,10 @@ namespace ICSharpCode.ILSpy static async Task GetLatestVersionAsync() { - WebClient wc = new WebClient(); - IWebProxy systemWebProxy = WebRequest.GetSystemWebProxy(); - systemWebProxy.Credentials = CredentialCache.DefaultCredentials; - wc.Proxy = systemWebProxy; - - string data = await wc.DownloadStringTaskAsync(UpdateUrl); + var client = new HttpClient(new HttpClientHandler() { + UseProxy = true, + }); + string data = await client.GetStringAsync(UpdateUrl); XDocument doc = XDocument.Load(new StringReader(data)); var bands = doc.Root.Elements("band");