-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use HttpClient to replace WebClient #11542
Conversation
this seems like a more involved change, I think I'd prefer suppressing the warning (the code is already doing that in some places) and file a follow-up issue. |
ef57ad1
to
281924b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11542 +/- ##
===================================================
- Coverage 74.45532% 74.42490% -0.03043%
===================================================
Files 3039 3039
Lines 628902 628889 -13
Branches 46831 46830 -1
===================================================
- Hits 468251 468050 -201
- Misses 157301 157484 +183
- Partials 3350 3355 +5
Flags with carried forward coverage won't be shown. Click here to find out more. |
ae7aab9
to
40eed0d
Compare
@kasperk81 the winforms maintainers need to ultimately decide but I think we'd get the flow unblocked more easily if we suppress the warning for now. |
@paul1956 I think was working on similar things for Winforms VB.Net. |
@elachlan I already did all the work for download in PR #9867 and PR #11215 but they are not being reviewed. Upload is a trivial change but writing a test server for upload is well beyond my ability I wrote all the tests using a public server which I was told was not allowed in Repo. None of the VB Code Upload/Download or FileIO has tests on Main branch, I wrote then to make sure error codes/exceptions are exactly the same. One minor issue is getting the error codes exactly the same requires SR entries and translation that I don't understand. |
@kasperk81 Is this still blocking for dotnet/sdk#41616? This was suppressed in a recent depenedency update above. |
@lonitra it's now replacing the httpclient to make it future proof. obsoletion is an indication that api may get removed in the future and here it's simply not worth keeping it. |
src/System.Windows.Forms/src/System/Windows/Forms/Controls/PictureBox/PictureBox.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/PictureBoxTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Controls/PictureBox/PictureBox.cs
Outdated
Show resolved
Hide resolved
9658c5b
to
44373d9
Compare
eed59a4
to
94278c4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, thank you! 🥳 We'll still need to do some slight documentation adjustments to reflect WebClient is no longer being used
Opened dotnet/docs#41485 for docs. |
This comment was marked as resolved.
This comment was marked as resolved.
I think this is worse than a breaking change. Current code can distinguish between a wrong password and a offline server or bad URL. After this change everything is an IO Error. This may not apply to loading an image but does apply to replacing WebClient.Sent from my iPhoneI apologize for any typos Siri might have made.(503) 803-6077On Jun 19, 2024, at 2:51 PM, Igor Velikorossov ***@***.***> wrote:
@lonitra I think this should be filed under "breaking change" with relevant docs, release docs and breaking change docs updated/generated.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
how are you providing password to this internal WebClient today?
HttpClient does not throw I/O exception. |
@kasperk81 my comments refer to the VB network code which currently uses WebClient also and does expose WebClient Exceptions to code calling the network functions. I have not looked at other uses. The comments here seem to say this breaking change is OK but I was hoping for a more holistic solution that covered all WebClient usage. |
I'm not sure I follow this. My understanding here is WebClient throws WebException for most of its methods and if we want to find out more about the error, we would need to refer to WebExceptionStatus. HttpRequestException similarly has HttpStatusCode which can be checked to determine more information about the error that occurred. I'm not familiar with VB network code usage of WebClient, but if we had previously handled status codes of the WebExceptions then we should make adjustments to continue to handle them in the same way with HttpRequestExceptions, but in PictureBox case we had not handled it. We have filed breaking change so it is up to caller to handle this for their specific scenario |
All of the VB upload and download functions look like this and they rethrow the WebClient exception. This is from Main
Then code like the following works, this is a test I wrote to cover this, but this also exists in applications including one I am maintaining. On bad password it prompts user to reenter and on Timeout it prompts for new download address.
Separate issue SR.net_webstatus_Timeout and SR.net_webstatus_Unauthorized are not accessible to the VB code in WinForms Repo. |
@paul1956 I think because its internal here its not so much an issue. VB.net will be different. |
@paul1956 Let's chat about VB scenario in your PR. |
this will unblock dotnet/sdk#41616
see dotnet/runtime#103456
fix #11544
Microsoft Reviewers: Open in CodeFlow