-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Description
MSBuild still uses the old string-based path manipulation almost everywhere, which leads to avoidable allocations in cases where the result of e.g. Path.GetFileName() is not stored on the heap.
Here's one example use of Path.GetFileName() which could be easily converted to Span:
| if (String.Equals(Path.GetFileName(ProjectFullPath), "dirs.proj", StringComparison.OrdinalIgnoreCase)) |
but there are many more, for other Path APIs as well as for helpers implemented in the MSBuild codebase. Some of them are trivial to fix, some will require deeper changes.
Note that the new Span-based public surface is available in the Microsoft.IO.Redist package on .NET Framework under the namespace Microsoft.IO instead of System.IO.