1

我在 windows phone 商店里有一个应用程序有一段时间了,一些人一直在给我发电子邮件关于错误。我无法复制这些问题,所以我在我的应用程序中添加了 bugsense。现在我开始收到很棒的错误报告。

我今天收到的一份报告在堆栈跟踪中包含以下内容

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);
                }
            });
4

0 回答 0