diff --git a/vscode-dotnet-runtime-extension/src/extension.ts b/vscode-dotnet-runtime-extension/src/extension.ts index 2f12640ef9..1b186913da 100644 --- a/vscode-dotnet-runtime-extension/src/extension.ts +++ b/vscode-dotnet-runtime-extension/src/extension.ts @@ -503,6 +503,11 @@ export function activate(vsCodeContext: vscode.ExtensionContext, extensionContex * This accounts for pmc installs, snap installs, bash configurations, and other non-standard installations such as homebrew. */ const dotnetFindPathRegistration = vscode.commands.registerCommand(`${commandPrefix}.${commandKeys.findPath}`, async (commandContext: IDotnetFindPathContext): Promise => + { + return findPath(commandContext); + }); + + async function findPath(commandContext: IDotnetFindPathContext): Promise { globalEventStream.post(new DotnetFindPathCommandInvoked(`The find path command was invoked.`, commandContext)); @@ -590,7 +595,7 @@ onHostfxrRecord : ${JSON.stringify(dotnetOnHostfxrRecord)} Requirement: ${JSON.stringify(commandContext)}`)); return undefined; - }); + } async function getPathIfValid(path: string | undefined, validator: IDotnetConditionValidator, commandContext: IDotnetFindPathContext): Promise { @@ -845,6 +850,14 @@ We will try to install .NET, but are unlikely to be able to connect to the serve return null; } + // Preemptively load the cacheable information for other extensions to try to increase performance. + const commonCaseCallingContext = { version: '9.0', mode: 'aspnetcore', requestingExtensionId: 'self', installType: 'local', architecture: os.platform() } as IDotnetAcquireContext; + callWithErrorHandling(async () => + { + await findPath({ acquireContext: commonCaseCallingContext, versionSpecRequirement: 'latestPatch', rejectPreviews: true }); + }, getIssueContext(existingPathConfigWorker)(AcquireErrorConfiguration.DisableErrorPopups, 'initialization-find', commonCaseCallingContext.version), commonCaseCallingContext.requestingExtensionId) + .catch(() => {}); + // Preemptively install .NET for extensions who tell us to in their package.json const jsonInstaller = new JsonInstaller(globalEventStream, vsCodeExtensionContext);