msbuild
msbuild copied to clipboard
use struct enumerator instead of using IEnumerable through yield retu…
…rns to prevent allocations
Fixes #
Context
We can see through traces that there are allocations due to the statemachine created to track yield returning IEnumerable.
(This can be shown with the type <FindAssemblyName>d_29 in image below.)
Changes Made
- To fix this issue, I created a struct enumerator that would wrap the collection to enumerate over rather than needing to use IEnumerable through yield returns.