dotnet / project-system

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

Further fixes in intercept provider supporting code #9447

Closed lifengl closed 2 months ago

lifengl commented 2 months ago

This PR is to address further issues showing in performance traces.

Due to the code is in the hot path to load solution, some further works:

1, first export was added twice in the list, which might be the reason of complex LINQ code later. This PR fixes the issue, but I keep the original LINQ code just to prevent changing behaviors.

2, Use MEF metadata instead of reflection APIs. MEF can cache strings efficiently, while reflection is slow, and also the code would load components then checking the capabilities, which is incorrect.

3, prevent using LINQ in this hot path, i updated it to a normal loop.

Microsoft Reviewers: Open in CodeFlow