microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.24k stars 28.87k forks source link

SON Schema Loading Issue with Proxy Settings on Windows 11 + WSL #219339

Open ianhsu927 opened 3 months ago

ianhsu927 commented 3 months ago

Hello,

I am experiencing an issue with Visual Studio Code when working on a Windows 11 system using WSL Arch Linux. It appears that VSCode's JSON schema loading process is using the proxy settings configured for Windows rather than those set for WSL.

System Information Operating System: Windows 11 WSL Distribution: Arch Linux VSCode Version: 1.90.2 Proxy Settings Windows Proxy: 127.0.0.1:7890 (Configured via Clash) WSL Proxy: 172.24.0.1:7890 (WSL Gateway Address) Issue Description When I try to load JSON schemas, it seems that VSCode is attempting to use the Windows proxy settings (127.0.0.1:7890). However, WSL uses a different proxy address (172.24.0.1:7890), causing connection failures and errors in schema loading.

Steps to Reproduce Configure Clash on Windows with the proxy address 127.0.0.1:7890. Set up WSL Arch Linux with a different proxy address (e.g., 172.24.0.1:7890). Open VSCode and attempt to load JSON schemas. Expected Behavior VSCode should respect the proxy settings configured for WSL when operating within the WSL environment, allowing JSON schema loading to succeed.

Actual Behavior VSCode uses the Windows proxy settings, leading to connection failures and schema loading errors.

Additional Information Please let me know if there are any logs or additional details I can provide to assist in troubleshooting this issue.

Thank you for your assistance. image

chrmarti commented 3 months ago

Where do you set https_proxy? That should indeed win over what you have configured locally.

ianhsu927 commented 3 months ago

Where do you set https_proxy? That should indeed win over what you have configured locally.

I have set the https_proxy in the user settings (JSON) under "terminal.integrated.env.linux: {}". Additionally, I have not configured http.proxy or "terminal.integrated.env.windows": {},.

vs-code-engineering[bot] commented 2 weeks ago

Hey @chrmarti, this issue might need further attention.

@ianhsu927, you can help us out by closing this issue if the problem no longer exists, or adding more information.

chrmarti commented 1 week ago

"terminal.integrated.env.linux: {}" only affects the terminal in VS Code. Try setting it in your ~/.bashrc or similar startup file.

ianhsu927 commented 1 week ago

"terminal.integrated.env.linux: {}" only affects the terminal in VS Code. Try setting it in your ~/.bashrc or similar startup file.

It seems that you misunderstood my point. I suspect that VSCode might be reading the proxy settings of the physical machine (Windows) when downloading JSON schema, which is 127.0.0.1:7890. For WSL with default settings, the IP of Windows is 172.17.0.1, and 127.0.0.1 refers to WSL itself. Therefore, for WSL, the IP of the proxy service should be 172.17.0.1, not 127.0.0.1. However, VSCode reads the proxy IP from Windows, which is 127.0.0.1, causing WSL to mistakenly believe that the proxy server IP is 127.0.0.1. Since no proxy service is running on WSL at 127.0.0.1:7890, the JSON schema download fails. I have resolved this issue by modifying the networkingMode to "mirrored" in the .wslconfig file on Windows, which mirrors the proxy service port from Windows to WSL, allowing the JSON schema to be downloaded normally.

Reference: WSL Networking - Mirrored Mode Networking