Symlinks cause an exception when formatting a workspace
- Dominant language
- No language data
- Stars
- 1.9k
- Forks
- 173
- Avg merge
- 10d 13h
- Merged PRs (30d)
- 1
Description
Hi,
We sometimes have symlinks in our repos, which breaks the formatter:
```
Unhandled exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\'.
at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
at System.IO.Enumeration.FileSystemEnumerator`1.Init()
at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at Microsoft.Extensions.FileSystemGlobbing.Abstractions.DirectoryInfoWrapper.EnumerateFileSystemInfos()+MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath)
at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Execute()
at Microsoft.Extensions.FileSystemGlobbing.Matcher.Execute(DirectoryInfoBase directoryInfo)
at Microsoft.Extensions.FileSystemGlobbing.MatcherExtensions.GetResultsInFullPath(Matcher matcher, String directoryPath)
at Microsoft.CodeAnalysis.Tools.Utilities.SourceFileMatcher.GetResultsInFullPath(String directoryPath) in /_/src/Utilities/SourceFileMatcher.cs:line 41
at Microsoft.CodeAnalysis.Tools.Workspaces.FolderWorkspace.FolderSolutionLoader.GetMatchingFilePaths(String folderPath, SourceFileMatcher fileMatcher) in /_/src/Workspaces/FolderWorkspace_FolderSolutionLoader.cs:line 54
at Microsoft.CodeAnalysis.Tools.Workspaces.FolderWorkspace.FolderSolutionLoader.LoadSolutionInfo(String folderPath, SourceFileMatcher fileMatcher) in /_/src/Workspaces/FolderWorkspace_FolderSolutionLoader.cs:line 18
at Microsoft.CodeAnalysis.Tools.Workspaces.FolderWorkspace.OpenFolder(String folderPath, SourceFileMatcher fileMatcher) in /_/src/Workspaces/FolderWorkspace.cs:line 41
at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, Boolean createBinaryLog) in /_/src/CodeFormatter.cs:line 45
at Microsoft.CodeAnalysis.Tools.Program.Run(String workspace, Boolean folder, Boolean fixWhitespace, String fixStyle, String fixAnalyzers, String verbosity, Boolean check, String[] include, String[] exclude, String report, Boolean includeGenerated, IConsole console) in /_/src/Program.cs:line 173
at System.CommandLine.Invocation.CommandHandler.GetResultCodeAsync(Object value, InvocationContext context)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__21_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<b__0>d.MoveNext()--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__22_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__20_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__11_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<b__0>d.MoveNext()
```
this is on windows 10, dotnet 5.0.102, format version 5.0.211001+10cb1372c1e5ea38316d1e77c4682b3bf950870f
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.