[release/6.0] Don't regress SkipLocalsInit optimization on < 6.0 .NETCoreApp assets...
authorViktor Hofer <viktor.hofer@microsoft.com>
Mon, 23 Aug 2021 15:11:01 +0000 (17:11 +0200)
committerGitHub <noreply@github.com>
Mon, 23 Aug 2021 15:11:01 +0000 (17:11 +0200)
commitf722cad8144b3eb92fe1f80c20c487daab46f101
treeaf6095dc4ea5ee5cfc31052c5e5c8646356019cf
parent740581cce911de2754375863188a3c3b2c5c9130
[release/6.0] Don't regress SkipLocalsInit optimization on < 6.0 .NETCoreApp assets (#57868)

* Don't regress SkipLocalsInit optimization on net5.0 assets

netcoreapp3.1 and net5.0 assets which are part of the Microsoft.NETCore.App shared framework and ship inside a package need to keep the SkipLocalsInit optimization to avoid regressing perf. This would happen when referencing one of the 6.0 packages but consuming either the netcoreapp3.1 or net5.0 asset in it. The higher assembly version of the netcoreapp3.1/net5.0 asset would win over the same asset in the shared framework and without this fix, the SkipLocalsInit optimization would be lost.

Contributes to https://github.com/dotnet/runtime/issues/54964
src/libraries/Directory.Build.targets
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/SkipLocalsInitAttribute.cs