Skip to content

Unloading Projects Causes Recently Loaded Projects to Disappear from Solution Explorer #517

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

Open
exprzw opened this issue Oct 3, 2024 · 0 comments

Comments

@exprzw
Copy link

exprzw commented Oct 3, 2024

Description:
When working with a solution that includes multiple unloaded projects, loading two or more projects programmatically displays them correctly in Solution Explorer. However, manually unloading one of these projects causes all recently loaded projects to disappear from Solution Explorer, despite remaining part of the solution.

Steps to Reproduce:

  • Open a solution containing some unloaded projects.
  • Load at least two of these projects programmatically using the code fragment below.
  • Verify that the projects are correctly loaded and visible in Solution Explorer.
  • In Solution Explorer, manually unload one of the recently loaded projects using the "Unload" command.

Expected Behavior:
Only the manually selected project should be unloaded and disappear from Solution Explorer. The other loaded projects should remain visible.

Actual Behavior:
When one project is manually unloaded, all recently loaded projects disappear from Solution Explorer, even though they remain part of the solution and can be found in the project list.

Additional Notes:
The issue persists even when attempting the workaround suggested in the repository ProjectFilter, which recommends adding await Task.Yield(); to ensure Visual Studio catches up with the changes. The workaround does not resolve the issue.

[Command(PackageIds.MyCommand)]
internal sealed class MyCommand : BaseCommand<MyCommand>
{
    protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
    {
        var projects = await VS.Solutions.GetAllProjectsAsync(ProjectStateFilter.Unloaded);
        var project = projects.FirstOrDefault();
        if (project != null)
        {
            await project.LoadAsync();
        }

        await Task.Yield();
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant