VsixCommunity / Community.VisualStudio.Toolkit

Making it easier to write Visual Studio extensions
Other
249 stars 44 forks source link

Error when removing unassigned files from solution folders in VS Experimental Instance with Demo Extension #469

Open Matt-17 opened 7 months ago

Matt-17 commented 7 months ago

Description

I encountered an error in Visual Studio when performing file operations within the Solution Explorer. Specifically, the error arises when I remove files that are not associated with any project but are added to solution folders. This minor issue seems to be triggered only when the demo extension is installed in my Visual Studio Experimental Instance.

Steps to Reproduce

  1. Open Visual Studio Experimental Instance with the demo extension installed.
  2. Add files to a solution folder without associating them with any project.
  3. Attempt to remove these files from the solution folder.

Expected Behavior

The files should be removed without any errors.

Actual Behavior

An error occurs, which seems to stem from a null reference exception. The specific line of code causing the issue is in TestExtensionPackage.cs at line 90:

  string info = string.Join(",", obj.ProjectItemRemoves.Select(x => $"{x.Project.Name}:{x.RemovedItemName}"));         

It appears that x.Project is null at this point, leading to the error when attempting to access its Name property.