Skip to content

Commit

Permalink
When producing ReadyToRun images, the ILLinker is configured to skip …
Browse files Browse the repository at this point in the history
…C++/CLI images. See dotnet/linker#651 and dotnet/linker#658.

In turn, this results in a failure of dependencies of such assemblies (like System.Diagnostics.Debug.dll, which is required by DirectWriteForwarder.dll) from being identified and included in the ReadyToRun images.

These linker hints tell ILLinker to include certain dependencies, which we know to be required by DirectWriteForwarder and System.Printing respectively.
  • Loading branch information
vatsan-madhavan committed Jul 25, 2019
1 parent b71b8b3 commit f427945
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Microsoft.DotNet.Wpf/src/PresentationCore/ILLinkTrim.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<linker>
<!-- Include dependencies of DirectWriteForwarder, which is not
analyzed by the linker. -->
<assembly fullname="System.Diagnostics.Debug" />
</linker>
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,29 @@
<XlfInput>false</XlfInput>
<ManifestResourceName>ColorProfiles</ManifestResourceName>
</EmbeddedResource>

<!--
Workaround for https://github.com/dotnet/wpf/issues/1385
ReadyToRun images of WPF applications crash
When producing ReadyToRun images, the ILLinker is configured to skip
C++/CLI images. See https://github.com/mono/linker/issues/651 and
https://github.com/mono/linker/pull/658.
In turn, this results in the failure of the dependencies of such assemblies from being
identified and included in the ReadyToRun images.
This linker hint exists to ensure that such dependencies are included. We need
to place these hints in an assembly that has a reference to the corresponding
C++/CLI assembly.
PresentationCore -> DirectWriteFowarder
ReachFramework -> System.Printing
-->
<EmbeddedResource Condition="Exists('ILLinkTrim.xml')" Include="ILLinkTrim.xml">
<XlfInput>false</XlfInput>
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>

<!-- Including the Microsoft.TextTemplating.targets requires us to manually import Sdk.Targets because
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.DotNet.Wpf/src/ReachFramework/ILLinkTrim.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<linker>
<!-- Include dependencies of System.Printing, which is not
analyzed by the linker. -->
<assembly fullname="System.Diagnostics.Debug" />
</linker>
23 changes: 23 additions & 0 deletions src/Microsoft.DotNet.Wpf/src/ReachFramework/ReachFramework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@
<LogicalName>System.Printing.resources</LogicalName>
<ManifestResourceName>System.Printing.resources</ManifestResourceName>
</EmbeddedResource>

<!--
Workaround for https://github.com/dotnet/wpf/issues/1385
ReadyToRun images of WPF applications crash
When producing ReadyToRun images, the ILLinker is configured to skip
C++/CLI images. See https://github.com/mono/linker/issues/651 and
https://github.com/mono/linker/pull/658.
In turn, this results in the failure of the dependencies of such assemblies from being
identified and included in the ReadyToRun images.
This linker hint exists to ensure that such dependencies are included. We need
to place these hints in an assembly that has a reference to the corresponding
C++/CLI assembly.
PresentationCore -> DirectWriteFowarder
ReachFramework -> System.Printing
-->
<EmbeddedResource Condition="Exists('ILLinkTrim.xml')" Include="ILLinkTrim.xml">
<XlfInput>false</XlfInput>
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit f427945

Please sign in to comment.