简体   繁体   English

在Rx Observable上等待期间,不能将CurrentPlatformEnlightenmentProvider强制转换为IPlatformEnlightenmentProvider

[英]CurrentPlatformEnlightenmentProvider can't be cast to IPlatformEnlightenmentProvider during await on Rx Observable

In a library that I've written I've got a function which creates an Rx ReplaySubject and pushes some things to it from a task, returning the subject as an IObservable for others to watch (it's just publishing some progress updates on the work the task is doing). 在我编写的库中,我有一个函数,该函数创建一个Rx ReplaySubject并从任务中向其中推送一些内容,将该主题作为IObservable返回给其他人观看(它只是发布关于任务正在执行)。

I'm then using the library in LINQPad, calling that function, and awaiting the observable: 然后,我在LINQPad中使用该库,调用该函数,然后等待可观察的对象:

scenario.SeedAsync(context).Wait();

I then get hit with a TypeInitializationException with the message: 然后,我收到一条带有消息的TypeInitializationException的提示:

Unable to cast object of type 'System.Reactive.PlatformServices.CurrentPlatformEnlightenmentProvider' to type 'System.Reactive.PlatformServices.IPlatformEnlightenmentProvider'. 无法将类型为“ System.Reactive.PlatformServices.CurrentPlatformEnlightenmentProvider”的对象转换为类型为“ System.Reactive.PlatformServices.IPlatformEnlightenmentProvider”的对象。

From what I can tell these enlightenment providers are a way for Rx to leverage platform specific functionality . 据我所知,这些启发提供者是Rx利用平台特定功能的一种方式 I figured that meant it might be a versioning mismatch or something, but I can't find anything obvious. 我认为这可能是版本不匹配之类的东西,但是我找不到明显的东西。 I've checked that the same version of Rx is included on both sides, it's my machine building the library, I'm running the AnyCPU build of LINQPad, but the library is also built for AnyCPU, so I think that should be OK. 我检查了双方是否都包含相同版本的Rx,这是我的机器在构建库,我正在运行LINQPad的AnyCPU构建,但是该库也是为AnyCPU构建的,所以我认为应该没问题。 I'm a bit stumped. 我有点难过。 I've even tried fiddling with different kinds of subjects and things in the code to make sure it's not specific to any of those. 我什至尝试摆弄代码中不同种类的主题和事物,以确保它不是特定于这些主题和事物的。

I haven't been able to find any hint of this error on Google or SO. 我无法在Google或SO上找到此错误的任何提示。

Any ideas? 有任何想法吗? I'm not really sure where to look further at this point! 我现在不确定在哪里可以进一步看!

我的心理调试器说您的Rx二进制文件与Linqpad中使用的版本不匹配

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM