Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VirtualFileProvider.GetDirectoryContents Recreates a String #12639

Open
Erarndt opened this issue Jun 7, 2023 · 1 comment
Open

VirtualFileProvider.GetDirectoryContents Recreates a String #12639

Erarndt opened this issue Jun 7, 2023 · 1 comment
Assignees
Labels
Community PRs (and linked Issues) created by someone not in the NuGet team Functionality:Restore Priority:2 Issues for the current backlog. Product:VS.Client Tenet:Performance Performance issues Type:Bug

Comments

@Erarndt
Copy link

Erarndt commented Jun 7, 2023

VirtualFileProvider splits up files into their respective path components in its constructor:

    public VirtualFileProvider(List<string> files)
    {
        _files = files.Select(file => file.Split(ForwardSlashChar)).ToList();
    }

And then goes to recreate these exact strings in VirtualFileProvider.GetDirectoryContents via string.Join:

        foreach (var file in _files)
        {
          ...
          var virtualFile = new VirtualFileInfo(string.Join(ForwardSlash, file));
          contents.Add(virtualFile);
        }

This can be avoided by keeping the original string around.

@ghost
Copy link

ghost commented Jun 7, 2023

Issue is missing Type label, remember to add a Type label

@ghost ghost added the missing-required-type The required type label is missing. label Jun 7, 2023
@ghost ghost removed the missing-required-type The required type label is missing. label Jun 13, 2023
@nkolev92 nkolev92 added the Community PRs (and linked Issues) created by someone not in the NuGet team label Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PRs (and linked Issues) created by someone not in the NuGet team Functionality:Restore Priority:2 Issues for the current backlog. Product:VS.Client Tenet:Performance Performance issues Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants