c# - MvvmCross - 启用链接所有程序集时缺少 View 模型参数

标签 c# xamarin mvvmcross

为了减小应用程序的大小,我在我的 Xamarin.iOS 应用程序上启用了“链接所有程序集”选项。不幸的是,当我启动应用程序时,传递简单的 View 模型参数不起作用。在应用程序输出中,我可以看到以下警告:

mvx:Diagnostic: 1.93 Missing parameter for call to ViewModel - missing parameter isLaunchedForTheFirstTime - assuming null - this may fail for value types! <br/><br/>mvx:Error: 1.94 Failed to parse BoolParser parameter isLaunchedForTheFirstTime from string

我不知道要向 LinkerPleaseInclude.cs 添加什么才能使其正常工作。有什么想法吗?

提前致谢!

编辑: 这是我的 preserve.xml 文件,其中包含所有引用的程序集:
http://pastebin.com/cEmLDxqn

还有我的 View 模型导航:

ShowViewModel<FirstViewModel>(new {isLaunchedForTheFirstTime = true})

[ImplementPropertyChanged]
public class FirstViewModel : MvxViewModel
{
    //properties
    public void Init(bool isLaunchedForTheFirstTime)
    {
        //handling parameter
    }
}

最佳答案

并非所有时间链接器都足够智能以检测项目运行所需的一切,尤其是在您使用 DI 或反射时。在这些情况下,您可以 configure它包含它可能遗漏的程序集/类型或方法。

关于c# - MvvmCross - 启用链接所有程序集时缺少 View 模型参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32067695/

相关文章:

c# - 等待来自子对象/ View 模型的事件

c# - 针对 Windows 10 UWP 时 PostAsync 引发 IRandomAccessStream 错误

c# - 创建泛型列表

c# - 对 Viewmodel 进行单元测试

c# - Xamarin.IOS 日期格式

c# - 从头开始为 Windows 8.1 创建 MvvmCross Store 应用程序的过程?

c# - MVVMCross Release 构建不工作(LinkerPleaseInclude Listview)

c# - EF关系一对二

android - 如何修复 .NetStandard 上的 HTTPClient 中的 "java.io.IOException: unexpected end of stream on Connection"异常

java - Android按钮点击显示不同的Toast消息取决于点击次数