dotnet / project-system

The .NET Project System for Visual Studio
MIT License
959 stars 386 forks source link

Avoidable project tree flags string allocations and marshalling in dependencies tree #9372

Closed drewnoakes closed 5 months ago

drewnoakes commented 6 months ago

Reported via email from @ToddGrun and @lifengl.

During Solution Explorer search, traces show a lot of allocations related to ProjectTreeFlags:   image

We use project tree flags in the dependencies node to identify different types of nodes. For attached nodes, we need to obtain these flags for a given IVsHiearchy item. We do this via the VSHPROPID_ProjectTreeCapabilities property.

This innocent property read actually does a bunch of work:

If we could instead access the ProjectTreeFlags of CPS's IProjectTree item directly, we could avoid this and allocation marshalling across COM native/managed boundaries.