Skip to content

Commit f1cc1fd

Browse files
authored
Merge pull request #1373 from nagilson/nagilson-proxy-ps-chmod-fix
1.7.3 Fixes - Proxy support + Powershell Attempts
2 parents 9deffdc + 5c3a965 commit f1cc1fd

20 files changed

+496
-46
lines changed

Documentation/troubleshooting-sdk.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ Learn more about configuring Visual Studio Code settings [here](https://code.vis
3030
}
3131
```
3232

33+
## The extension thinks you are offline with error response of 400 or 407, and you have a proxy.
34+
35+
This is a known issue with axios, the system we use to make web-requests.
36+
The requests we make need to be routed through the proxy. We have logic to try to detect your proxy automatically.
37+
If your proxy does not get detected by us, please try adding it here.
38+
39+
Note: GFW / China also blocks some of our requests, which may be why our extension thinks you are offline or times out.
40+
41+
```json
42+
{
43+
"dotnetSDKAcquisitionExtension.proxyUrl": "https://your_proxy_url:port"
44+
}
45+
3346
## Other Issues
3447

3548
Haven't found a solution? Check out our [open issues](https://github.com/dotnet/vscode-dotnet-runtime/issues). If you don't see your issue there, please file a new issue by evoking the `.NET SDK Install Tool: Report an issue with the .NET SDK Install Tool` command from Visual Studio Code.

vscode-dotnet-runtime-extension/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning].
1010
## [1.7.3] - 2023-08-24
1111

1212
Fixes an issue where install script files could have race conditions by introducing file locking mechanisms.
13+
Adds proxy detection & support that forwards calls through a proxy to axios. This is to fix a bug in axios where it does not handle proxies correctly.
14+
Attempts to discover powershell in more ways in case it's been removed from the PATH, or try using powershell core if only that is available.
15+
Improves file permissions handling to prevent issues on mac and linux where install script files may not have the correct permissions to execute.
16+
Remarks in error messages how users in China may experience timeouts or offline errors due to GFW blocking our download pages.
1317

1418
## [1.7.2] - 2023-08-24
1519

vscode-dotnet-runtime-extension/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ It can sometimes take a while to download the .NET Runtime. While the default do
5050

5151
You can read more about [changing the installation timeout] in our documentation.
5252

53+
## The extension thinks you are offline with error response of 400 or 407, and you have a proxy.
54+
55+
This is a known issue with axios, the system we use to make web-requests.
56+
The requests we make need to be routed through the proxy. We have logic to try to detect your proxy automatically.
57+
If your proxy does not get detected by us, please try adding it here.
58+
You may want to consider temporarily switching to version 1.7.2 of the runtime extension if you are still experiencing issues as this version does not use axios. Note that proxies that require additional credentials are not yet supported.
59+
60+
Note: GFW / China also blocks some of our requests, which may be why our extension thinks you are offline or times out.
61+
62+
You can add the proxy in the extension settings like following the advice above for timeouts.
63+
```json
64+
{
65+
"dotnetSDKAcquisitionExtension.proxyUrl": "https://your_proxy_url:port"
66+
}
67+
```
68+
5369
## Information for repo contributors
5470

5571
### Goals: Acquiring .NET Runtimes for extensions

vscode-dotnet-runtime-extension/package-lock.json

Lines changed: 96 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-dotnet-runtime-extension/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
"dotnetAcquisitionExtension.existingDotnetPath": {
6868
"type": "array",
6969
"description": "File Path to an existing installation of .NET."
70+
},
71+
"dotnetAcquisitionExtension.proxyUrl": {
72+
"type": "string",
73+
"description": "URL to a proxy if you use one, such as: https://proxy:port"
7074
}
7175
}
7276
}
@@ -91,6 +95,7 @@
9195
"glob": "^7.2.0",
9296
"got": "11.8.5",
9397
"hmac-drbg": "^1.0.1",
98+
"https-proxy-agent": "^7.0.2",
9499
"is-online": "^9.0.1",
95100
"mocha": "^9.1.3",
96101
"open": "^8.4.0",

vscode-dotnet-runtime-extension/src/extension.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace configKeys {
4747
export const installTimeoutValue = 'installTimeoutValue';
4848
export const enableTelemetry = 'enableTelemetry';
4949
export const existingPath = 'existingDotnetPath';
50+
export const proxyUrl = 'proxyUrl';
5051
}
5152
namespace commandKeys {
5253
export const acquire = 'acquire';
@@ -100,6 +101,8 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
100101
}
101102
const resolvedTimeoutSeconds = timeoutValue === undefined ? defaultTimeoutValue : timeoutValue;
102103

104+
const proxyUrl = extensionConfiguration.get<string>(configKeys.proxyUrl);
105+
103106
const acquisitionWorker = new DotnetCoreAcquisitionWorker({
104107
storagePath: context.globalStoragePath,
105108
extensionState: context.globalState,
@@ -110,7 +113,7 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
110113
installDirectoryProvider: new RuntimeInstallationDirectoryProvider(context.globalStoragePath),
111114
});
112115
const existingPathResolver = new ExistingPathResolver();
113-
const versionResolver = new VersionResolver(context.globalState, eventStream, resolvedTimeoutSeconds);
116+
const versionResolver = new VersionResolver(context.globalState, eventStream, resolvedTimeoutSeconds, proxyUrl);
114117

115118
const dotnetAcquireRegistration = vscode.commands.registerCommand(`${commandPrefix}.${commandKeys.acquire}`, async (commandContext: IDotnetAcquireContext) => {
116119
const dotnetPath = await callWithErrorHandling<Promise<IDotnetAcquireResult>>(async () => {

vscode-dotnet-runtime-extension/src/test/functional/DotnetCoreAcquisitionExtension.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ suite('DotnetCoreAcquisitionExtension End to End', function() {
108108
const requestedEvent = MockTelemetryReporter.telemetryEvents.find((event: ITelemetryEvent) => event.eventName === 'DotnetAcquisitionRequested');
109109
assert.exists(requestedEvent);
110110
assert.include(requestedEvent!.properties!.AcquisitionStartVersion, '2.2');
111-
assert.notInclude(requestedEvent!.properties!.RequestingExtensionId, requestingExtensionId); // assert that the extension id is hashed
111+
assert.notInclude(requestedEvent!.properties!.RequestingExtensionId, requestingExtensionId); // assert that the extension id is hashed by checking that it DNE
112112
const startedEvent = MockTelemetryReporter.telemetryEvents.find((event: ITelemetryEvent) => event.eventName === 'DotnetAcquisitionStarted');
113113
assert.exists(startedEvent);
114114
assert.include(startedEvent!.properties!.AcquisitionStartVersion, '2.2');

vscode-dotnet-runtime-extension/yarn.lock

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,13 @@
401401
"resolved" "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/acorn/-/acorn-8.10.0.tgz"
402402
"version" "8.10.0"
403403

404+
"agent-base@^7.0.2":
405+
"integrity" "sha1-U2gCt2vAs0qlAZXrJEInbWE+NDQ="
406+
"resolved" "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/agent-base/-/agent-base-7.1.0.tgz"
407+
"version" "7.1.0"
408+
dependencies:
409+
"debug" "^4.3.4"
410+
404411
"agent-base@6":
405412
"integrity" "sha1-Sf/1hXfP7j83F2/qtMIuAPhtf3c="
406413
"resolved" "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/agent-base/-/agent-base-6.0.2.tgz"
@@ -849,6 +856,13 @@
849856
"shebang-command" "^2.0.0"
850857
"which" "^2.0.1"
851858

859+
"debug@^4.3.4":
860+
"integrity" "sha1-Exn2V5NX8jONMzfSzdSRS7XcyGU="
861+
"resolved" "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/debug/-/debug-4.3.4.tgz"
862+
"version" "4.3.4"
863+
dependencies:
864+
"ms" "2.1.2"
865+
852866
"debug@4", "[email protected]":
853867
"integrity" "sha1-BCZuC3CpjURi5uKI44JZITMytmQ="
854868
"resolved" "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/debug/-/debug-4.3.3.tgz"
@@ -1410,6 +1424,14 @@
14101424
"agent-base" "6"
14111425
"debug" "4"
14121426

1427+
"https-proxy-agent@^7.0.2":
1428+
"integrity" "sha1-4mRbhGuQ6WxubzR/tbLkHxWQsJs="
1429+
"resolved" "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz"
1430+
"version" "7.0.2"
1431+
dependencies:
1432+
"agent-base" "^7.0.2"
1433+
"debug" "4"
1434+
14131435
"human-signals@^2.1.0":
14141436
"integrity" "sha1-3JH8ukLk0G5Kuu0zs+ejwC9RTqA="
14151437
"resolved" "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public-npm/npm/registry/human-signals/-/human-signals-2.1.0.tgz"
@@ -2538,8 +2560,10 @@
25382560
"diff" ">=5.0.0"
25392561
"eol" "^0.9.1"
25402562
"es-abstract" "^1.19.1"
2563+
"get-proxy-settings" "^0.1.13"
25412564
"got" "11.8.5"
25422565
"http-cache-semantics" "4.1.1"
2566+
"https-proxy-agent" "^7.0.2"
25432567
"is-online" "9.0.1"
25442568
"mocha" "^9.1.3"
25452569
"open" "^8.4.0"

0 commit comments

Comments
 (0)