-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
blockingUsed by the API Review BoardUsed by the API Review Boardtenet-modernizationModernizing WinForms UIModernizing WinForms UI
Description
ServicePointManager and WebClient are obselete, but are being used in PictureBox
winforms/src/System.Windows.Forms/src/System/Windows/Forms/Controls/PictureBox/PictureBox.cs
Lines 500 to 524 in 520c319
| private void LoadImageViaWebClient() | |
| { | |
| Image img; | |
| Uri uri = CalculateUri(_imageLocation!); | |
| if (uri.IsFile) | |
| { | |
| _localImageStreamReader = new StreamReader(uri.LocalPath); | |
| img = Image.FromStream(_localImageStreamReader.BaseStream); | |
| } | |
| else | |
| { | |
| if (LocalAppContextSwitches.ServicePointManagerCheckCrl) | |
| { | |
| ServicePointManager.CheckCertificateRevocationList = true; | |
| } | |
| #pragma warning disable SYSLIB0014 // Type or member is obsolete | |
| using WebClient webClient = new(); // lgtm[cs/webrequest-checkcertrevlist-disabled] - Having ServicePointManager.CheckCertificateRevocationList set to true has a slim chance of resulting in failure. We have an opt-out for this rare event. | |
| #pragma warning restore SYSLIB0014 // Type or member is obsolete | |
| _uriImageStream = webClient.OpenRead(uri.ToString()); | |
| img = Image.FromStream(_uriImageStream); | |
| } | |
| InstallNewImage(img, ImageInstallationType.FromUrl); | |
| } |
We needed to suppress SYSLIB0014 warning in #11540 to unblock depdency flow, but we should update this code to use HttpClient
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
blockingUsed by the API Review BoardUsed by the API Review Boardtenet-modernizationModernizing WinForms UIModernizing WinForms UI