Skip to content

Commit f4b7db4

Browse files
authored
Merge pull request #6231 from dotnet/dev/arkalyan/symlink
Replace symlink resolution with realpath
2 parents 58ac5fa + 85dd092 commit f4b7db4

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
- Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876)
1010

1111
## Latest
12+
* Fix UriFormatException during dotnet SDK resolution when symlinks are involved (PR: [#6230](https://github.com/dotnet/vscode-csharp/pull/6230))
13+
14+
## 2.0.413
1215
* Update Roslyn version (PR: [#6192](https://github.com/dotnet/vscode-csharp/pull/6192))
1316
* Add support for compilation end diagnostics (PR: [#69541](https://github.com/dotnet/roslyn/pull/69541))
1417
* Include CodeLens on more types and members (PR: [#69608](https://github.com/dotnet/roslyn/pull/69608))

src/lsptoolshost/dotnetRuntimeExtensionResolver.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { CSharpExtensionId } from '../constants/csharpExtensionId';
1515
import { promisify } from 'util';
1616
import { exec } from 'child_process';
1717
import { getDotnetInfo } from '../shared/utils/getDotnetInfo';
18-
import { readFile, readlink } from 'fs/promises';
18+
import { readFile, realpath } from 'fs/promises';
1919

2020
export const DotNetRuntimeVersion = '7.0';
2121

@@ -183,13 +183,7 @@ export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
183183

184184
// If dotnet is just a symlink, resolve it to the actual executable so
185185
// callers will be able to get the actual directory containing the exe.
186-
try {
187-
const targetPath = await readlink(path);
188-
return targetPath;
189-
} catch {
190-
// Not a symlink.
191-
return path;
192-
}
186+
return await realpath(path);
193187
} catch (e) {
194188
this.channel.appendLine(
195189
'Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime'

0 commit comments

Comments
 (0)