-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trimming default WPF app breaks it #14261
Comments
I am looking for guidance on how to publish a WPF app using |
This is probably a combination of linker changes (being more precise) and WPF changes. System.RuntimeIt's referenced from code which linker doesn't see, because the module Note that this is injected via ILDASM/ILASM from this file https://github.com/dotnet/wpf/blob/master/eng/WpfArcadeSdk/tools/InjectModuleInitializer/ModuleInitializer.il System.Runtime.ExtensionsIt's referenced from the C++/CLI assembly DirectWriterForwarder. System.Diagnostics.DebugAgain referenced from DirectWriterFormatter So as a workaround I added: <ItemGroup>
<TrimmerRootAssembly Include="System.Runtime"/>
<TrimmerRootAssembly Include="System.Runtime.Extensions"/>
<TrimmerRootAssembly Include="System.Diagnostics.Debug"/>
</ItemGroup> To the project and now the empty template app works (checked that there are no exceptions at runtime either). The size savings are interesting but not amazing. Untrimmed size: 148MB, trimmed size: 91MB. |
This should be replaced by the proper C# module initializer now that that C# can emit them. |
I just tried using the module initializer and it fixes the problem with that part of the code https://github.com/vitek-karas/wpf/tree/UseModuleInit. But it uncovers another problem:
|
Closing as dup of dotnet/wpf#3811 |
👍 Replacing this infrastructure is exactly why @rladuca and I pushed for the C# module-initializer feature (along with many others for many other good reasons). This should absolutely be changed in .NET 6. The ILASM/ILDASM trick is ok for now, but it's meta-stable at best. |
Running the app "does nothing" no window shows up.
Note that this is a regression from 3.1 where this worked.
Used:
5.0.100-rtm.20515.8
SDKThe text was updated successfully, but these errors were encountered: