Trimming breaks page navigation #391
-
I'm not positive if the title is an accurate description of what's going on behind the scenes, but I have an Avalonia 11/FluentAvalonia app (https://github.com/PhantomGamers/SFP) that works fine when compiled either without trimming or with TrimMode set to partial, however when TrimMode is set to full (the default value), the navigation view shows but it never actually navigates to a page (and the nav buttons don't navigate either). I have managed to make a slightly more barebones reproduction of the issue on this project Where the build published with But with the default TrimMode value set, publishing with I can't reproduce this issue with the sample app (both the current version and v2), but I have no idea what I'm doing wrong. I'll keep looking into this myself but I figured I would ask here in case someone has any idea as I've been trying to figure this out for a while now. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I had a quick look at your code, and you're navigating via You can look into |
Beta Was this translation helpful? Give feedback.
-
That solved it, thanks a lot! I did it a little differently by just passing the page instance directly so I didn't have to change my code that much but it works great! |
Beta Was this translation helpful? Give feedback.
I had a quick look at your code, and you're navigating via
Frame.Navigate(Type)
. This utilizesActivator.CreateInstance
(reflection) to create the page views, which is likely the reason.You can look into
INavigationPageFactory
which hands over the page creation to you (also allowing passing a ViewModel instance instead of just a Type). This is how the new sample app works, and the Frame page has some example code and instructions on this. I think that should help prevent this issue.