dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.22k stars 1.36k forks source link

Need a well-known function fast path for Version.ToString(int) in the evaluator #10719

Closed KirillOsenkov closed 3 hours ago

KirillOsenkov commented 3 hours ago

Seeing a couple of first-chance MissingMethodExceptions during eval because we evaluate this expression now: <_MSBuildVersionMajorMinor>$([System.Version]::Parse('$(MSBuildVersion)').ToString(2))</_MSBuildVersionMajorMinor> from C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\Microsoft.NETCoreSdk.BundledMSBuildInformation.props (I couldn't find the source code for this file)

https://github.com/dotnet/msbuild/blob/ab7c28995f198f717aa5fb823e6fc36cadf42254/src/Build/Evaluation/Expander.cs#L3709

KirillOsenkov commented 3 hours ago

Here specifically: https://github.com/dotnet/msbuild/blob/ab7c28995f198f717aa5fb823e6fc36cadf42254/src/Build/Evaluation/Expander.cs#L4489-L4496

Is it not getting called already?

KirillOsenkov commented 3 hours ago

Ah, never mind, looks like @YuliiaKovalova already fixed this in https://github.com/dotnet/msbuild/pull/10409

KirillOsenkov commented 3 hours ago

Duplicate of #10398