【发布时间】:2017-01-03 13:58:35
【问题描述】:
我创建了一个使用 F# 和 ReactiveUI 的 Xamarin Android 项目。
加载我的仪表板时,我在此代码 sn-p 的 inherit 行遇到运行时异常(类型为 MissingMethodException):
type DashboardViewModel(?host: IScreen) =
inherit ReactiveViewModel()
let host = LocateIfNone host
member __.Title with get() = "Dashboard"
interface IRoutableViewModel with
member __.HostScreen = host
member __.UrlPathSegment = "Dashboard"
错误信息显示
找不到方法“Microsoft.FSharp.Quotations.FSharpExpr.Deserialize40”。
ReactiveViewModel 类型是ReactiveObject 的薄包装:
type ReactiveViewModel() as this =
inherit ReactiveObject()
let mutable message = noMessage
let uiContext = SynchronizationContext.Current
member __.SyncContext with get() = uiContext
member this.Message
with get() = message
and set(value) =
this.RaiseAndSetIfChanged(&message, value, "Message") |> ignore
if message <> noMessage then this.RaiseAndSetIfChanged(&message, noMessage, "Message") |> ignore
member val MessageSent =
this.WhenAnyValue(toLinq <@ fun vm -> vm.Message @>).ObserveOn(RxApp.MainThreadScheduler).Where(fun m -> m <> noMessage) with get
该项目是开源的:目前,它包含的内容很少。可以在https://github.com/SpiegelSoft/Astrid找到。
我在 Xamarin 错误跟踪器上提交了一个错误:https://bugzilla.xamarin.com/show_bug.cgi?id=51000
是否有任何已知的修复程序我可以自己实施,以便我可以自行关闭错误?
更新 1
这个周末我一直在调查这个问题。
加载的 FSharp.Core 版本卡在过时的版本 2.3.98.1 上。这对应于
中的FSharp.Core.dll文件
C:\Program Files (x86)\参考 程序集\Microsoft\Framework\MonoAndroid\v1.0
我已尝试删除此版本并加载 NuGet 包 FSharp.Core;但是,当我构建 Android 项目时,该路径始终会还原为 Reference Assemblies 路径中的过时文件。
有没有办法覆盖这种行为?
更新 2
替换Reference Assemblies 路径中的FSharp.Core.dll 文件可以解决问题,但这是一个非常不令人满意的粘贴膏,我无法要求我的用户申请。理想情况下,我想找到一种方法来阻止 .Droid 项目从 GAC 而不是 NuGet 包加载 FSharp.Core。
【问题讨论】:
-
我猜
MissingMemberException等价于MissingMethodException。如果是这样,这里的一些现有帖子可能会对您有所帮助:stackoverflow.com/search?q=%5Bf%23%5D+MissingMethodException -
我的错误——它是
MissingMethodException。问题已修改。 -
IME 总是由版本冲突引起的。
-
这些通常可以通过绑定重定向来解决。不幸的是,我的项目是 Xamarin Android 项目,所以我不能使用 app.config 文件。
标签: android xamarin f# xamarin.forms reactiveui