-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Link trimming doesn't appear to work with Avalonia 11 (11.0.999-cibuild0026354-beta) #9127
Comments
Avalonia is not compatible with link trimming for now. But you can workaround it with TrimmerRootDescriptor: <linker>
<assembly fullname="your main assembly name" preserve="all" />
<assembly fullname="Avalonia.Base">
<type fullname="Avalonia.Animation.Animators.TransformAnimator" />
</assembly>
<!-- for all assemblies that have xaml code -->
<assembly fullname="xxxx">
<type fullname="CompiledAvaloniaXaml.!AvaloniaResources" />
<type fullname="CompiledAvaloniaXaml.!IndexerAccessorFactoryClosure" />
<type fullname="CompiledAvaloniaXaml.!XamlLoader" />
<type fullname="CompiledAvaloniaXaml.XamlIlContext" />
<type fullname="CompiledAvaloniaXaml.XamlIlContext/ParentStackEnumerable/Enumerator" />
<type fullname="CompiledAvaloniaXaml.XamlIlHelpers" />
<type fullname="CompiledAvaloniaXaml.XamlIlTrampolines" />
</assembly>
<assembly fullname="System.Private.CoreLib">
<type fullname="System.StubHelpers.InterfaceMarshaler" preserve="all" />
</assembly>
</linker> |
Im confused:
Originally posted by @maxkatz6 in #6892 (comment) |
It works with TrimMode=copyused. |
Yes, it seems we still have a problem with StyleInclude. |
Also the problem with UI automation (we need to replace them with ComWrappers) |
@jmacato Can this be re-opened? I've attempted the same action with the build from the PR that closed this issue and this does not appear to have been resolved. I'm getting an IL linker error when publishing trimmed in .NET 7 & version
|
#9537 does fix the link trimming failure, but the trimmed binary still does not run.
|
@KieranDevvs please attach full stack trace of the inner exception as well if there are similar errors.
|
@KieranDevvs can you test again with this build #9537 (comment) ? |
So with that build, I get a step further, Im able to publish and run the trimmed binary however, when the window launches, none of the controls are rendered and I don't see any exceptions in Windows Event Viewer this time. What I get if I run an untrimmed build: What I get if I run a trimmed (self contained) build: Edit: Just did a little more investigation and it looks like the controls are rendering but its the binding that doesnt have a value. If I had to guess, I would say that the ViewModel with the binding value has been detected as unused & trimmed from the published assembly. Another Edit: I can confirm the view model bindings have been trimmed: |
@KieranDevvs are you using compiled bindings? It won't ever work with reflection bindings. https://docs.avaloniaui.net/docs/data-binding/compiledbindings |
Ah that worked, thanks, I appreciate the help. |
Describe the bug
When publishing a link trimmed self contained, single file executable, the application crashes upon startup.
The error in Event Viewer seems to indicate that it can't find the fluent theme, suggesting that it has been trimmed out, but the project configuration specifies to keep that assembly.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The trimmed executable to run.
Screenshots
N/a
Desktop (please complete the following information):
Additional context
N/a
The text was updated successfully, but these errors were encountered: