MvvmCross
MvvmCross copied to clipboard
LinkerPleaseInclude should move to using the new DynamicDependency
Description
LinkerPleaseInclude has proven necessary in order to link apps without runtime issues. However, the current suggested way of doing is by including the LinkerPleaseInclude class which has the attribute Preserve. This attribute is marked as deprecated and will stop working at some point, which will cause a lot of MvvmCross apps to crash with release mode at runtime.
Here I see two options (correct me if I'm wrong):
- Use the new trimmer configurations to preserve the whole
LinkerPleaseIncludeclasse (see this) - Check if now there are better ways to avoid this to happen (I know this issue comes from the linker not playing well with reflection if I'm not mistaken). Maybe it's unrelated, but it seems like one of the maintainers from MVVM Toolkit already battled with this
Intended Use-Case
Avoid runtime crashes for trimmed MvvmCross apps in the future
Yeah, I've tried that already. Most of MvvmCross core will have to be marked as referencing external assemblies. I.e. it is not linker safe.
Mainly because of the built in IoC container. Also for bindings lots of reflection use.
So easier said than done and a ton of work.
Would the new changes you're trying to do with regards to moving to the Microsoft IoC already remove a lot of possible issues?
If so, then I guess that to fix the binding reflection issues it would be possible to go binding by binding and adding the DynamicDependency attribute and defining the members that will be used in the binding?
I agree it's a ton of work, but just figuring out if this would be the approach in case we wanted to fix it