Trim in .net 6 breaks self contained single file publish mode
See original GitHub issueDescribe the bug References required for file dialogs will break. There’s an exception when trying to use them.
To Reproduce Steps to reproduce the behavior:
- Run an avalonia app with a folder dialog
- publish it with .net 6 with trim enabled
- see the exception
Desktop (please complete the following information):
- OS: Windows
- Version 0.10.8
Additional context Work around, add these settings into your project file
<TrimMode>copyused</TrimMode>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
this will prevent the needed files from being trimmed, and prevent com from being disabled which is needed.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Trim self-contained applications - .NET
Enable trimming · Add <PublishTrimmed>true</PublishTrimmed> to your project file. This property will produce a trimmed app on self-contained ...
Read more >Trimming options - .NET
If you change the trim mode to partial , you can opt-in individual assemblies to trimming by using a <TrimmableAssembly> MSBuild item. XML...
Read more >Shrinking a Self-Contained .NET 6 Wordle-Clone Executable
Shrinking a Self-Contained .NET 6 Wordle-Clone Executable. Shrinking the size of an executable in .NET can be more than just TrimMode.
Read more >JsonConvert.DeserializeObjects does not work with trim ...
The method JsonConvert.DeserializeObjects works when "Trim unused code" publish setting is off. When I turn this setting on I get: Newtonsoft.
Read more >Single File Apps In .NET 6 - NET Core Tutorials
NET 6 has the ability to trim unneeded dependencies from your application. By default, when you publish a self contained application you get ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It was fixed in 11.0 preview.
I use the latest version (0.10.10). Actually, this problem occurs with
OpenFileDialog
as well. In Linux (Debian), IL trimming doesn’t break open folder/file dialog.