VsixCommunity / Community.VisualStudio.Toolkit

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

RemoveAsync method from ReferenceCollection throws System.AccessViolationException #409

Open anton-gabriel opened 1 year ago

anton-gabriel commented 1 year ago

The RemoveAsync method from Community.VisualStudio.Toolkit.ReferenceCollection throws a System.AccessViolationException when used.

Package Version Community.VisualStudio.Toolkit.17 version 17.0.486

Visual Studio version Visual Studio 2022

Target Framework .NET Framework 4.8

Steps to Reproduce I used the example provided by @reduckted in this page: https://github.com/VsixCommunity/Community.VisualStudio.Toolkit/pull/180. More precisely the following lines of code:

Project project = await VS.Solutions.GetActiveProjectAsync();
await project.References.RemoveAsync(project.References.OfType<ProjectReference>().ToArray());

Screenshots image

Please let me know if you need any more information to reproduce the issue.