Skip to content

Commit 304768b

Browse files
authored
Use --opt-cross-module only for assemblies within the servicing bubble (#77900)
2 parents dd1b95b + 0a74369 commit 304768b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,26 @@
8282
</PropertyGroup>
8383
</Target>
8484

85+
<Target Name="AddCrossAssemblyOptimizationSwitch"
86+
DependsOnTargets="ResolveProjectReferences"
87+
AfterTargets="ResolveProjectReferences">
88+
<!-- We used to use - -opt-cross-module:* as a switch, but inlining code
89+
from the runtime led to exposing bugs in crossgen/runtime in not rejecting
90+
native code when the inlined code was stale.
91+
To avoid customer facing bugs in C# extension, we are now taking the more
92+
conservative approach of only inlining code from assemblies in the same
93+
"servicing bubble", which we can most closely approximate here by just
94+
inlining code in assemblies that come from project references. -->
95+
<ItemGroup>
96+
<_OptCrossModuleSwitch
97+
Condition="'%(_ResolvedProjectReferencePaths.ReferenceOutputAssembly)'=='true'"
98+
Include="@(_ResolvedProjectReferencePaths->'--opt-cross-module:%(FileName)')" />
99+
</ItemGroup>
100+
<PropertyGroup>
101+
<PublishReadyToRunCrossgen2ExtraArgs>$(PublishReadyToRunCrossgen2ExtraArgs);@(_OptCrossModuleSwitch)</PublishReadyToRunCrossgen2ExtraArgs>
102+
</PropertyGroup>
103+
</Target>
104+
85105
<ItemGroup Label="Project References">
86106
<ProjectReference Include="..\..\Workspaces\MSBuild\Core\Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj" />
87107
<ProjectReference Include="..\..\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj" />

0 commit comments

Comments
 (0)