Add a DynamicallyAccessedMembers attribute to ViewBuilder.Create #288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(sort of) refs #281.
So... I've been using FuncUI to build an app that i've been publishing as a self contained, trimmed, exe (it's built with .NET 7, but you can run it without having to have an appropriate .NET version installed, and has fewer files to care about).
For various reasons (many things being broken basically), I've had it on partial trim mode so that it only trims libs that are explicitly marked as trimmable, whilst waiting for thins to get fixed or improve elsewhere. (e.g. the completion of some work in Avalonia to help it work better with trimming).
In Avalonia 11 Preview 6, parts of Avalonia are marked as trimmable, so they will be trimmed now when they weren't before. This should be quite nice as it will remove controls you aren't using and such, but alas it also causes this to happen with FuncUI:
because the trimmer can't find any references to said constructor and therefore bins it.
Activator.CreateInstance is annotated to explain this and in C# there is a roslyn analyzer that will try to tell you about that so that you can annotate your own code to be compatible, but no such help in F#.
Anyway, I'm sure there are other code paths that have the same issue (e.g. the ones that create instances of things and use a constructor with parameters), but just doing this one fixes the issues i'm getting by making it retain all the default constructors for used controls, so I'm opening this to at least open the question on how this situation should be handled.