diff --git a/vscode-dotnet-runtime-library/src/Acquisition/DotnetCoreAcquisitionWorker.ts b/vscode-dotnet-runtime-library/src/Acquisition/DotnetCoreAcquisitionWorker.ts index bb9c24ac..b540c59d 100644 --- a/vscode-dotnet-runtime-library/src/Acquisition/DotnetCoreAcquisitionWorker.ts +++ b/vscode-dotnet-runtime-library/src/Acquisition/DotnetCoreAcquisitionWorker.ts @@ -31,6 +31,7 @@ import { SuppressedAcquisitionError, EventBasedError, EventCancellationError, + DotnetInstallationValidated, } from '../EventStream/EventStreamEvents'; import { GlobalInstallerResolver } from './GlobalInstallerResolver'; @@ -60,6 +61,7 @@ import { InstallTrackerSingleton } from './InstallTrackerSingleton'; import { DotnetInstallMode } from './DotnetInstallMode'; import { IEventStream } from '../EventStream/EventStream'; import { IExtensionState } from '../IExtensionState'; +import { CommandExecutor } from '../Utils/CommandExecutor'; import { getInstallIdCustomArchitecture } from '../Utils/InstallIdUtilities'; /* tslint:disable:no-any */ @@ -405,12 +407,35 @@ ${WinMacGlobalInstaller.InterpretExitCode(installerResult)}`), install); throw err; } - const installedSDKPath : string = await installer.getExpectedGlobalSDKPath(installingVersion, + let installedSDKPath : string = await installer.getExpectedGlobalSDKPath(installingVersion, context.acquisitionContext.architecture ?? this.getDefaultInternalArchitecture(context.acquisitionContext.architecture)); TelemetryUtilities.setDotnetSDKTelemetryToMatch(context.isExtensionTelemetryInitiallyEnabled, this.extensionContext, context, this.utilityContext); - context.installationValidator.validateDotnetInstall(install, installedSDKPath, os.platform() !== 'win32'); + try + { + context.installationValidator.validateDotnetInstall(install, installedSDKPath, os.platform() !== 'win32'); + } + catch(error : any) + { + if(os.platform() === 'darwin') + { + const executor = new CommandExecutor(context, this.utilityContext); + const result = await executor.execute(CommandExecutor.makeCommand('which', ['dotnet'])); + if(result.status === '0') + { + context.eventStream.post(new DotnetInstallationValidated(install)); + installedSDKPath = result.stdout; + } + else + { + error.message += `Which dotnet returned ${result.stdout} and ${result.stderr}.`; + throw error; + } + } + + throw error; + } context.eventStream.post(new DotnetAcquisitionCompleted(install, installedSDKPath, installingVersion)); diff --git a/vscode-dotnet-runtime-library/src/Acquisition/InstallationValidator.ts b/vscode-dotnet-runtime-library/src/Acquisition/InstallationValidator.ts index 3c9947a4..c08a6c45 100644 --- a/vscode-dotnet-runtime-library/src/Acquisition/InstallationValidator.ts +++ b/vscode-dotnet-runtime-library/src/Acquisition/InstallationValidator.ts @@ -11,6 +11,7 @@ import { } from '../EventStream/EventStreamEvents'; import { IInstallationValidator } from './IInstallationValidator'; import { DotnetInstall } from './DotnetInstall'; +import { CommandExecutor } from '../Utils/CommandExecutor'; export class InstallationValidator extends IInstallationValidator { public validateDotnetInstall(install: DotnetInstall, dotnetPath: string, isDotnetFolder = false): void { @@ -41,7 +42,8 @@ export class InstallationValidator extends IInstallationValidator { } private assertOrThrowError(check: boolean, message: string, install: DotnetInstall, dotnetPath: string) { - if (!check) { + if (!check) + { this.eventStream.post(new DotnetInstallationValidationError(new Error(message), install, dotnetPath)); throw new EventBasedError('DotnetInstallationValidationError', message); }