Skip to content

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

@exprzw

Description

@exprzw

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();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions