runtime: Specific Win10/11 Proxysettings cause wrong result in WebRequest.DefaultWebProxy.GetProxy(...)

Description

Believe it or not!

I noticed when running .NET 6 Framework on Win10 Build 1905.3324 with VS 2022 17.6.5 it seem to be important that the URL given in the System -> Proxysetting does not contain any “http://” prefixes in the address field.

As long as Proxysetting is stored with “http://”, the following code always returns NULL instead of the proxy Uri

WebRequest.DefaultWebProxy.GetProxy("https://google.de")

Reproduction Steps

  1. create a simple console app with WebRequest.DefaultWebProxy.GetProxy("https://google.de") to return
  2. Configure the Win10 System -> Proxysettings to contain “http://” in the address field (E.g. Address: http://proxy.fqdn.local Port: 3128) and keep the proxy exceptions empty
  3. Enable and save the Proxysettings
  4. Run the console app and expect a NULL to be returned from GetProxy(...) method

Expected behavior

WebRequest.DefaultWebProxy.GetProxy("https://google.de") should return the Proxy URL given in the Proxysettings of the system

Actual behavior

WebRequest.DefaultWebProxy.GetProxy("https://google.de") returns NULL

Regression?

I assume it worked on .NET 4.x since I used this framework version before migrating to .NET 6

Known Workarounds

NOW COME THE FUN PART

The workaround to use the very old “Internet option” which is still available in Win10

image

Since, the Proxy configuration from the “Internet options” dialog causes the proxy address to always be stored without “http://” prefix

Configuration

  1. .NET 6
  2. Win10 Build 1905.3324
  3. x64 platform
  4. Visual Studio 2022 17.6.5

Other information

No response

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@dotMorten example projects are already to my comment for .net 4.8, 6.0 and 7.0

Thanks @karelz . I work on a different SDK but will try and find who owns this part of the pro SDK. However since that SDK is for making plugins for a desktop product they probably don’t have the ability to move to .net7+. It should be possible to try it in an external net7 app though although that won’t help a plug-in user.

@ole1986 can you check with ArcGIS Pro SDK if .NET 7.0 is acceptable? Is it left out from their supported versions just because they don’t have time to support it or test it? Perhaps it is expected to just work … I also expect they have plans to support .NET 8.0 as soon as it will be out (November), right?

Paging @dotMorten if has insights here …