Skip to content

Commit 2c4ca30

Browse files
authored
Merge pull request #1613 from nagilson/nagilson-2.0.1-release
Fix SDK Linux Updates, & Add Cancellation Messages - 2.0.1 Release
2 parents 946b20d + aac1f73 commit 2c4ca30

22 files changed

+229
-81
lines changed

sample/package-lock.json

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

sample/yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,7 @@
18321832

18331833
"vscode-dotnet-runtime@file:../vscode-dotnet-runtime-extension":
18341834
"resolved" "file:../vscode-dotnet-runtime-extension"
1835-
"version" "2.0.0"
1835+
"version" "2.0.1"
18361836
dependencies:
18371837
"axios" "^1.3.4"
18381838
"axios-cache-interceptor" "^1.0.1"
@@ -1860,7 +1860,7 @@
18601860

18611861
"vscode-dotnet-sdk@file:../vscode-dotnet-sdk-extension":
18621862
"resolved" "file:../vscode-dotnet-sdk-extension"
1863-
"version" "2.0.0"
1863+
"version" "2.0.1"
18641864
dependencies:
18651865
"@types/chai" "4.2.22"
18661866
"@types/chai-as-promised" "^7.1.4"

vscode-dotnet-runtime-extension/CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,27 @@ The format is based on [Keep a Changelog],
66
and this project adheres to [Semantic Versioning].
77

88
## [Unreleased]
9-
## [2.0.0] - 2023-09-18
9+
## [2.0.1] - 2024-01-03
10+
11+
Fixes several key bugs with installing .NET:
12+
13+
- Ubuntu Global SDK Installs would fail for the first time on 18.04.
14+
- The extension would print ... forever after installation failure for certain errors.
15+
- The extension would fail to read Ubuntu directories properly for the first time if PMC was installed in certain scenarios.
16+
- GitHub Forms is now added.
17+
- Corrects behavior on our unknown Ubuntu Versions by estimating the correct behavior for known versions.
18+
- Improve timeout error handling
19+
- Catch bug in the caching library we use to prevent it from failing to cache
20+
- Remove bug where status bar would stay red when cancelling install
21+
- Fix bug where Linux would not update .NET SDKs properly when it could update instead of install
22+
- Detect when a user cancels the installation in the password prompt or windows installer so we can remove the error failure message
23+
- Adds more logging to the extension to improve diagnostics and speed to resolve github issues
24+
- Improve installation management, so that the extension is aware that installs it manages can be deleted by external sources, to prevent it from thinking something is installed when it is no longer installed.
25+
- Fix an issue where the uninstall command would think it could uninstall a global SDK. This is not the case.
26+
- Improve detection logic for existing Ubuntu and RHEL installations of linux to prevent installing when it is not needed
27+
- Several other key issues.
28+
29+
## [2.0.0] - 2023-11-23
1030

1131
The '.NET Runtime Install Tool' has been renamed to the '.NET Install Tool.'
1232

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

Lines changed: 2 additions & 2 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"description": "This extension installs and manages different versions of the .NET SDK and Runtime.",
1414
"appInsightsKey": "02dc18e0-7494-43b2-b2a3-18ada5fcb522",
1515
"icon": "images/dotnetIcon.png",
16-
"version": "2.0.0",
16+
"version": "2.0.1",
1717
"publisher": "ms-dotnettools",
1818
"engines": {
1919
"vscode": "^1.74.0"

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
106106
showLogCommand: `${commandPrefix}.${commandKeys.showAcquisitionLog}`,
107107
packageJson
108108
} as IEventStreamContext;
109-
const [eventStream, outputChannel, loggingObserver, eventStreamObservers, telemetryObserver] = registerEventStream(eventStreamContext, vsCodeExtensionContext, utilContext);
109+
const [globalEventStream, outputChannel, loggingObserver, eventStreamObservers, telemetryObserver] = registerEventStream(eventStreamContext, vsCodeExtensionContext, utilContext);
110110

111111

112112
// Setting up command-shared classes for Runtime & SDK Acquisition
@@ -125,8 +125,8 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
125125
const dotnetAcquireRegistration = vscode.commands.registerCommand(`${commandPrefix}.${commandKeys.acquire}`, async (commandContext: IDotnetAcquireContext) => {
126126
let fullyResolvedVersion = '';
127127
const dotnetPath = await callWithErrorHandling<Promise<IDotnetAcquireResult>>(async () => {
128-
eventStream.post(new DotnetRuntimeAcquisitionStarted(commandContext.requestingExtensionId));
129-
eventStream.post(new DotnetAcquisitionRequested(commandContext.version, commandContext.requestingExtensionId));
128+
globalEventStream.post(new DotnetRuntimeAcquisitionStarted(commandContext.requestingExtensionId));
129+
globalEventStream.post(new DotnetAcquisitionRequested(commandContext.version, commandContext.requestingExtensionId));
130130

131131
runtimeAcquisitionWorker.setAcquisitionContext(commandContext);
132132
telemetryObserver?.setAcquisitionContext(runtimeContext, commandContext);
@@ -154,7 +154,7 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
154154
}, runtimeIssueContextFunctor(commandContext.errorConfiguration, 'acquire', commandContext.version), commandContext.requestingExtensionId, runtimeContext);
155155

156156
const installKey = runtimeAcquisitionWorker.getInstallKey(fullyResolvedVersion);
157-
eventStream.post(new DotnetRuntimeAcquisitionTotalSuccessEvent(commandContext.version, installKey, commandContext.requestingExtensionId ?? '', dotnetPath?.dotnetPath ?? ''));
157+
globalEventStream.post(new DotnetRuntimeAcquisitionTotalSuccessEvent(commandContext.version, installKey, commandContext.requestingExtensionId ?? '', dotnetPath?.dotnetPath ?? ''));
158158
return dotnetPath;
159159
});
160160

@@ -167,8 +167,8 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
167167

168168
const pathResult = callWithErrorHandling(async () =>
169169
{
170-
eventStream.post(new DotnetSDKAcquisitionStarted(commandContext.requestingExtensionId));
171-
eventStream.post(new DotnetAcquisitionRequested(commandContext.version, commandContext.requestingExtensionId));
170+
globalEventStream.post(new DotnetSDKAcquisitionStarted(commandContext.requestingExtensionId));
171+
globalEventStream.post(new DotnetAcquisitionRequested(commandContext.version, commandContext.requestingExtensionId));
172172

173173
const existingPath = await resolveExistingPathIfExists(existingPathConfigWorker, commandContext);
174174
if(existingPath)
@@ -196,7 +196,7 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
196196

197197
const dotnetAcquireStatusRegistration = vscode.commands.registerCommand(`${commandPrefix}.${commandKeys.acquireStatus}`, async (commandContext: IDotnetAcquireContext) => {
198198
const pathResult = callWithErrorHandling(async () => {
199-
eventStream.post(new DotnetAcquisitionStatusRequested(commandContext.version, commandContext.requestingExtensionId));
199+
globalEventStream.post(new DotnetAcquisitionStatusRequested(commandContext.version, commandContext.requestingExtensionId));
200200
const resolvedVersion = await runtimeVersionResolver.getFullRuntimeVersion(commandContext.version);
201201
const dotnetPath = await runtimeAcquisitionWorker.acquireStatus(resolvedVersion, true);
202202
return dotnetPath;
@@ -220,7 +220,7 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
220220
const result = cp.spawnSync(commandContext.command, commandContext.arguments);
221221
const installer = new DotnetCoreDependencyInstaller();
222222
if (installer.signalIndicatesMissingLinuxDependencies(result.signal!)) {
223-
eventStream.post(new DotnetAcquisitionMissingLinuxDependencies());
223+
globalEventStream.post(new DotnetAcquisitionMissingLinuxDependencies());
224224
await installer.promptLinuxDependencyInstall('Failed to run .NET runtime.');
225225
}
226226
}, runtimeIssueContextFunctor(commandContext.errorConfiguration, 'ensureDependencies'));
@@ -239,7 +239,7 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
239239

240240
const existingPath = existingPathResolver.resolveExistingPath(configResolver.getPathConfigurationValue(), commandContext.requestingExtensionId, displayWorker);
241241
if (existingPath) {
242-
eventStream.post(new DotnetExistingPathResolutionCompleted(existingPath.dotnetPath));
242+
globalEventStream.post(new DotnetExistingPathResolutionCompleted(existingPath.dotnetPath));
243243
return new Promise((resolve) => {
244244
resolve(existingPath);
245245
});
@@ -254,8 +254,8 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
254254
return {
255255
storagePath: context.globalStoragePath,
256256
extensionState: context.globalState,
257-
eventStream,
258-
installationValidator: new InstallationValidator(eventStream),
257+
eventStream: globalEventStream,
258+
installationValidator: new InstallationValidator(globalEventStream),
259259
timeoutSeconds: resolvedTimeoutSeconds,
260260
installDirectoryProvider: isRuntimeInstall ? new RuntimeInstallationDirectoryProvider(context.globalStoragePath): new SdkInstallationDirectoryProvider(context.globalStoragePath),
261261
proxyUrl: proxyLink,
@@ -276,7 +276,7 @@ export function activate(context: vscode.ExtensionContext, extensionContext?: IE
276276
errorConfiguration: errorConfiguration || AcquireErrorConfiguration.DisplayAllErrorPopups,
277277
displayWorker,
278278
extensionConfigWorker: configResolver,
279-
eventStream,
279+
eventStream: globalEventStream,
280280
commandName,
281281
version,
282282
moreInfoUrl,

vscode-dotnet-runtime-library/distro-data/distro-support.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
"commandParts": ["-f", "{path}"]
272272
}
273273
],
274-
"expectedDistroFeedInstallDirectory": "/usr/lib64/dotnet/dotnet",
274+
"expectedDistroFeedInstallDirectory": "/usr/lib64/dotnet",
275275
"expectedMicrosoftFeedInstallDirectory": "",
276276
"installedSDKVersionsCommand": [
277277
{

vscode-dotnet-runtime-library/src/Acquisition/DotnetCoreAcquisitionWorker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ export class DotnetCoreAcquisitionWorker implements IDotnetCoreAcquisitionWorker
335335

336336
this.context.eventStream.post(new DotnetBeginGlobalInstallerExecution(`Beginning to run installer for ${installKey} in ${os.platform()}.`))
337337
const installerResult = await installer.installSDK();
338-
this.context.eventStream.post(new DotnetCompletedGlobalInstallerExecution(`Beginning to run installer for ${installKey} in ${os.platform()}.`))
338+
this.context.eventStream.post(new DotnetCompletedGlobalInstallerExecution(`Completed installer for ${installKey} in ${os.platform()}.`))
339339

340340
if(installerResult !== '0')
341341
{

vscode-dotnet-runtime-library/src/Acquisition/GenericDistroSDKProvider.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,23 @@ export class GenericDistroSDKProvider extends IDistroDotnetSDKProvider
3535
public async getInstalledGlobalDotnetPathIfExists(installType : LinuxInstallType) : Promise<string | null>
3636
{
3737
const commandResult = await this.commandRunner.executeMultipleCommands(this.myDistroCommands(this.currentInstallPathCommandKey));
38+
39+
const oldReturnStatusSetting = this.commandRunner.returnStatus;
40+
this.commandRunner.returnStatus = true;
41+
const commandSignal = await this.commandRunner.executeMultipleCommands(this.myDistroCommands(this.currentInstallPathCommandKey));
42+
this.commandRunner.returnStatus = oldReturnStatusSetting;
43+
44+
if(commandSignal[0] !== '0') // no dotnet error can be returned, dont want to try to parse this as a path
45+
{
46+
return null;
47+
}
48+
3849
if(commandResult[0])
3950
{
4051
commandResult[0] = commandResult[0].trim();
4152
}
4253

43-
if(commandResult && this.resolvePathAsSymlink)
54+
if(commandResult[0] && this.resolvePathAsSymlink)
4455
{
4556
let symLinkReadCommand = this.myDistroCommands(this.readSymbolicLinkCommandKey);
4657
symLinkReadCommand = CommandExecutor.replaceSubstringsInCommands(symLinkReadCommand, this.missingPathKey, commandResult[0]);
@@ -51,7 +62,7 @@ export class GenericDistroSDKProvider extends IDistroDotnetSDKProvider
5162
}
5263
}
5364

54-
return commandResult[0];
65+
return commandResult[0] ?? null;
5566
}
5667

5768
public async dotnetPackageExistsOnSystem(fullySpecifiedDotnetVersion : string, installType : LinuxInstallType) : Promise<boolean>
@@ -77,11 +88,15 @@ export class GenericDistroSDKProvider extends IDistroDotnetSDKProvider
7788

7889
public async upgradeDotnet(versionToUpgrade : string, installType : LinuxInstallType): Promise<string>
7990
{
91+
const oldReturnStatusSetting = this.commandRunner.returnStatus;
92+
this.commandRunner.returnStatus = true;
93+
8094
let command = this.myDistroCommands(this.updateCommandKey);
8195
const sdkPackage = await this.myDotnetVersionPackageName(versionToUpgrade, installType);
8296
command = CommandExecutor.replaceSubstringsInCommands(command, this.missingPackageNameKey, sdkPackage);
8397
const commandResult = (await this.commandRunner.executeMultipleCommands(command))[0];
8498

99+
this.commandRunner.returnStatus = oldReturnStatusSetting;
85100
return commandResult[0];
86101
}
87102

vscode-dotnet-runtime-library/src/Acquisition/LinuxVersionResolver.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import
99
{
1010
DotnetAcquisitionDistroUnknownError,
1111
DotnetConflictingLinuxInstallTypesError,
12-
DotnetCustomLinuxInstallExistsError
12+
DotnetCustomLinuxInstallExistsError,
13+
DotnetInstallLinuxChecks,
14+
DotnetUpgradedEvent
1315
} from '../EventStream/EventStreamEvents';
1416
import { GenericDistroSDKProvider } from './GenericDistroSDKProvider'
1517
import { VersionResolver } from './VersionResolver';
@@ -67,6 +69,8 @@ export class LinuxVersionResolver
6769
protected distroSDKProvider : IDistroDotnetSDKProvider | null = null;
6870
protected commandRunner : ICommandExecutor;
6971
protected versionResolver : VersionResolver;
72+
public okUpdateExitCode = 11188; // Arbitrary number that is not shared or used by other things we rely on as an exit code
73+
public okAlreadyExistsExitCode = 11166;
7074

7175
public conflictingInstallErrorMessage = `A dotnet installation was found which indicates dotnet that was installed via Microsoft package feeds. But for this distro and version, we only acquire .NET via the distro feeds.
7276
You should not mix distro feed and microsoft feed installations. To continue, please completely remove this version of dotnet to continue by following https://learn.microsoft.com/dotnet/core/install/remove-runtime-sdk-versions?pivots=os-linux.
@@ -181,9 +185,9 @@ export class LinuxVersionResolver
181185
case 'Red Hat Enterprise Linux':
182186
if(this.isRedHatVersion7(distroAndVersion.version))
183187
{
184-
const error = new DotnetAcquisitionDistroUnknownError(new Error(this.redhatUnsupportedDistroErrorMessage), getInstallKeyFromContext(this.acquireContext));
185-
this.acquisitionContext.eventStream.post(error);
186-
throw error.error;
188+
const unsupportedRhelErr = new DotnetAcquisitionDistroUnknownError(new Error(this.redhatUnsupportedDistroErrorMessage), getInstallKeyFromContext(this.acquireContext));
189+
this.acquisitionContext.eventStream.post(unsupportedRhelErr);
190+
throw unsupportedRhelErr.error;
187191
}
188192
return new RedHatDistroSDKProvider(distroAndVersion, this.acquisitionContext, this.utilityContext);
189193
default:
@@ -250,34 +254,43 @@ export class LinuxVersionResolver
250254
* @returns 0 if we can proceed. Will throw if a conflicting install exists. If we can update, it will do the update and return 1.
251255
* A string is returned in case we want to make this return more info about the update.
252256
*/
253-
private async UpdateOrRejectIfVersionRequestDoesNotRequireInstall(fullySpecifiedDotnetVersion : string, existingInstall : string | null)
257+
private async UpdateOrRejectIfVersionRequestDoesNotRequireInstall(fullySpecifiedDotnetVersion : string, existingInstall : string | null) : Promise<string>
254258
{
255259
await this.Initialize();
256260

261+
this.acquisitionContext.eventStream.post(new DotnetInstallLinuxChecks(`Checking to see if we should install, update, or cancel...`));
257262
if(existingInstall)
258263
{
259264
const existingGlobalInstallSDKVersion = await this.distroSDKProvider!.getInstalledGlobalDotnetVersionIfExists();
260265
if(existingGlobalInstallSDKVersion && Number(this.versionResolver.getMajorMinor(existingGlobalInstallSDKVersion)) ===
261266
Number(this.versionResolver.getMajorMinor(fullySpecifiedDotnetVersion)))
262267
{
263-
if(Number(this.versionResolver.getMajorMinor(existingGlobalInstallSDKVersion)) > Number(this.versionResolver.getMajorMinor(fullySpecifiedDotnetVersion)))
268+
const isPatchUpgrade = Number(this.versionResolver.getFeatureBandPatchVersion(existingGlobalInstallSDKVersion)) <
269+
Number(this.versionResolver.getFeatureBandPatchVersion(fullySpecifiedDotnetVersion));
270+
271+
if(Number(this.versionResolver.getMajorMinor(existingGlobalInstallSDKVersion)) > Number(this.versionResolver.getMajorMinor(fullySpecifiedDotnetVersion))
272+
|| Number(this.versionResolver.getFeatureBandFromVersion(existingGlobalInstallSDKVersion)) > Number(this.versionResolver.getFeatureBandFromVersion(fullySpecifiedDotnetVersion)))
264273
{
265274
// We shouldn't downgrade to a lower patch
266275
const err = new DotnetCustomLinuxInstallExistsError(new Error(`An installation of ${fullySpecifiedDotnetVersion} was requested but ${existingGlobalInstallSDKVersion} is already available.`),
267276
getInstallKeyFromContext(this.acquireContext));
268277
this.acquisitionContext.eventStream.post(err);
269278
throw err.error;
270279
}
271-
else if(await this.distroSDKProvider!.dotnetPackageExistsOnSystem(fullySpecifiedDotnetVersion, 'sdk') ||
272-
Number(this.versionResolver.getFeatureBandPatchVersion(existingGlobalInstallSDKVersion)) < Number(this.versionResolver.getFeatureBandPatchVersion(fullySpecifiedDotnetVersion)))
280+
else if(await this.distroSDKProvider!.dotnetPackageExistsOnSystem(fullySpecifiedDotnetVersion, 'sdk') || isPatchUpgrade)
273281
{
274282
// We can update instead of doing an install
275-
return (await this.distroSDKProvider!.upgradeDotnet(existingGlobalInstallSDKVersion, 'sdk')) ? '1' : '1';
283+
this.acquisitionContext.eventStream.post(new DotnetUpgradedEvent(
284+
isPatchUpgrade ?
285+
`Updating .NET: Current Version: ${existingGlobalInstallSDKVersion} to ${fullySpecifiedDotnetVersion}.`
286+
:
287+
`Repairing .NET Packages for ${existingGlobalInstallSDKVersion}.`));
288+
return (await this.distroSDKProvider!.upgradeDotnet(existingGlobalInstallSDKVersion, 'sdk')) === '0' ? String(this.okUpdateExitCode) : '1';
276289
}
277290
else
278291
{
279292
// An existing install exists.
280-
return '1';
293+
return String(this.okAlreadyExistsExitCode);
281294
}
282295
}
283296
// Additional logic to check the major.minor could be added here if we wanted to prevent installing lower major.minors if an existing install existed.
@@ -310,7 +323,11 @@ export class LinuxVersionResolver
310323
{
311324
return await this.distroSDKProvider!.installDotnet(fullySpecifiedDotnetVersion, 'sdk') ? '0' : '1';
312325
}
313-
return updateOrRejectState;
326+
else if(updateOrRejectState === String(this.okUpdateExitCode) || updateOrRejectState === String(this.okAlreadyExistsExitCode))
327+
{
328+
return '0';
329+
}
330+
return String(updateOrRejectState);
314331
}
315332

316333
/**

0 commit comments

Comments
 (0)