Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Observable.FromAsyncPattern()被卡住_C#_System.reactive_Reactive Programming - Fatal编程技术网

C# Observable.FromAsyncPattern()被卡住

C# Observable.FromAsyncPattern()被卡住,c#,system.reactive,reactive-programming,C#,System.reactive,Reactive Programming,我正在尝试使用RX从WCF下载一些数据。但是,Observable.FromAsyncPattern()使用SelecMany组合时不会返回任何响应 我试图在下面的片段中强调这个问题: var timer = Observable.Timer(TimeSpan.FromSeconds(1)); var obs = Observable.FromAsyncPattern<PictureFile>(ServiceClient.BeginDownloadFilePreview, Servi

我正在尝试使用RX从WCF下载一些数据。但是,
Observable.FromAsyncPattern()
使用
SelecMany组合时不会返回任何响应

我试图在下面的片段中强调这个问题:

var timer = Observable.Timer(TimeSpan.FromSeconds(1));
var obs = Observable.FromAsyncPattern<PictureFile>(ServiceClient.BeginDownloadFilePreview, ServiceClient.EndDownloadFilePreview);

obs().Subscribe(x => Debug.WriteLine("I am here"));

var result = from _ in timer
             from data in obs()
             select data;

result.Subscribe(x => Debug.WriteLine("Can't get here :( "));
var timer=Observable.timer(TimeSpan.FromSeconds(1));
var obs=Observable.FromAsyncPattern(ServiceClient.BeginDownloadFilePreview,ServiceClient.EndDownloadFilePreview);
obs().Subscribe(x=>Debug.WriteLine(“我在这里”);
var结果=来自计时器中的uu
来自obs()中的数据
选择数据;
result.Subscribe(x=>Debug.WriteLine(“无法到达此处:”);
因此,如果正确理解RX和
SelecMany
,上述代码应打印:

“我在这里”

“到不了这里:(”

但是,它只打印第一行,而不打印第二行

编辑:忘了提及此代码在没有附加调试器的情况下运行良好,但如果我在没有调试器的情况下运行它,则会失败。

刚刚找到它

首先,我不应该接受异常,即使它是一个测试代码,并且应该记录IObservable报告的所有异常

其次,我在MSUnit测试中运行我的项目,当使用附加的dubugger运行项目时,它影响了WCF绑定的maxReceivedMessageSize(至少看起来是这样),所以当我在调试模式下运行时,它一切正常,但在没有它的情况下运行时,一个请求失败,但我没有看到它,因为我没有签入错误消息

经验教训:始终记录错误消息