Skip to content

Commit 2896b4f

Browse files
committed
Optimize to not call getDotnetInfo unless needed
1 parent 35abfe4 commit 2896b4f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/coreclr-debug/activate.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,16 @@ export class DebugAdapterExecutableFactory implements vscode.DebugAdapterDescrip
168168

169169
// debugger has finished installation, kick off our debugger process
170170

171-
// Check for targetArchitecture
172-
let dotNetInfo = await getDotnetInfo(this.options.dotNetCliPaths);
173-
const targetArchitecture: string = getTargetArchitecture(this.platformInfo, _session.configuration.targetArchitecture, dotNetInfo);
174-
175171
// use the executable specified in the package.json if it exists or determine it based on some other information (e.g. the session)
176172
if (!executable) {
173+
const dotNetInfo = await getDotnetInfo(this.options.dotNetCliPaths);
174+
const targetArchitecture = getTargetArchitecture(this.platformInfo, _session.configuration.targetArchitecture, dotNetInfo);
177175
const command = path.join(common.getExtensionPath(), ".debugger", targetArchitecture, "vsdbg-ui" + CoreClrDebugUtil.getPlatformExeExtension());
178-
executable = new vscode.DebugAdapterExecutable(command, [], { env: { 'DOTNET_ROOT' : dotNetInfo.CliPath ? path.dirname(dotNetInfo.CliPath) : '' } });
176+
executable = new vscode.DebugAdapterExecutable(command, [], {
177+
env: {
178+
DOTNET_ROOT: dotNetInfo.CliPath ? path.dirname(dotNetInfo.CliPath) : '',
179+
}
180+
});
179181
}
180182

181183
// make VS Code launch the DA executable

0 commit comments

Comments
 (0)