我在Windows手机商店有一个应用程序已经有一段时间了,有几个人一直在给我发电子邮件给我发错。我无法复制问题所以我将bugsense添加到我的应用程序中。现在我开始收到错误报告,这很好。
我今天收到的其中一份报告在stacktrace中有以下内容
at Microsoft.Phone.Reactive.ObservableExtensions.b__3[TSource](Exception exception)
at Microsoft.Phone.Reactive.AnonymousObserver`1.Error(Exception exception)
at Microsoft.Phone.Reactive.AbstractObserver`1.OnError(Exception exception)
at Microsoft.Phone.Reactive.AnonymousObservable`1.AutoDetachObserver.Error(Exception exception)
at Microsoft.Phone.Reactive.AbstractObserver`1.OnError(Exception exception)
at Microsoft.Phone.Reactive.Observable.<>c__DisplayClass161`1.<>c__DisplayClass163.b__160()
at Microsoft.Phone.Reactive.CurrentThreadScheduler.Trampoline.Run()
at Microsoft.Phone.Reactive.CurrentThreadScheduler.EnsureTrampoline(Action action)
at Microsoft.Phone.Reactive.AnonymousObservable`1.Subscribe(IObserver`1 observer)
at Microsoft.Phone.Reactive.Observable.<>c__DisplayClass323`1.<>c__DisplayClass325.b__31e()
at Microsoft.Phone.Reactive.ThreadPoolScheduler.<>c__DisplayClass5.b__3(Object _)
at System.Threading.Timer.ring()
评论是该操作已经超时。
问题是我在各个地方通过应用程序使用Observable,那么如何跟踪错误的生成位置?
编辑: 我刚刚发现了我正在使用的Observable.TimeOut,这可能是原因吗?
IObservable<IEvent<TheWeatherBug.GetLocationListCompletedEventArgs>> observable =
Observable.FromEvent<TheWeatherBug.GetLocationListCompletedEventArgs>(WeatherBugService, "GetLocationListCompleted").Take(1);
var ObservableTimeout = Observable.Timeout(observable, TimeSpan.FromSeconds(10));
ObservableTimeout.Subscribe(w =>
{
pbarSearch.Visibility = System.Windows.Visibility.Collapsed;
if (w.EventArgs.Error == null)
{
locations = w.EventArgs.Result;
foreach (TheWeatherBug.ApiLocationData ap in locations)
{
if (ap.City.Contains(location))
if (!lbxLocations.Items.Contains(ap.City + " - " + ap.Country))
lbxLocations.Items.Add(ap.City + " - " + ap.Country);
}
if (lbxLocations.Items.Count == 0)
MessageBox.Show("Sorry could not find a city called " + location);
}
});