dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.24k stars 4.73k forks source link

Core 3.1 for WinForms System.Net.WebClient Upload.String(string,string,string) overload is broken #43013

Closed Budsy closed 3 years ago

Budsy commented 4 years ago

The bug: (.NET Core 3.1 winforms VS project)

System.Net.WebClient.UploadString(string url, string method, string payload) nor the Uri,string,string overload will not compile. Intellisense shows the overload option as documented for Core 3.1, but shows warning and won't compile.

To Reproduce

Simply open a VisualStudio2019 project for .NET Core 3.1 winforms and try to construct:

System.Net.WebClient client = new System.Net.WebClient(); var response = client.UploadString(url,"POST","{'hello':'goodbye'}");

Exceptions not reproduceable because this code will prevent compilation.

ASP.NET Core version:

.NET Core SDK (reflecting any global.json): Version: 3.1.302 Commit: 41faccf259

Runtime Environment: OS Name: Windows OS Version: 10.0.18362 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.302\

Visual Studio info:

Microsoft Visual Studio Community 2019 Version 16.6.5 VisualStudio.16.Release/16.6.5+30320.27 Microsoft .NET Framework Version 4.8.03752

Installed Version: Community

Dotnet-GitSync-Bot commented 4 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost commented 4 years ago

Tagging subscribers to this area: @dotnet/ncl See info in area-owners.md if you want to be subscribed.

hez2010 commented 4 years ago

System.Net.WebClient was deprecated and removed, instead you need to use System.Net.HttpClient.

stephentoub commented 4 years ago

System.Net.WebClient was deprecated and removed

It was obsoleted in .NET 5, but it wasn't removed. It's still there and not marked as obsolete in .NET Core 3.1.

To Reproduce

I did this and it compiles fine for me. Can you share your repro project that fails to compile?

ghost commented 3 years ago

This issue has been automatically marked as no recent activity because it has been marked as needing more info but has not had any activity for 14 days. It will be closed if no further activity occurs within 7 more days.

ghost commented 3 years ago

This issue has been automatically marked no recent activity because it has been marked as needs author feedback but has not had any activity for 14 days. It will be closed if no further activity occurs within 7 more days. Any new comment (by anyone, not necessarily the author) will remove no recent activity