我的问题是,如果我调试我的后台任务Windows 8 Store App
并获得一个Error
(同时异步方法调用)。它不会跳到我的 catch 语句中。调试器跳转到deferral.Complete()
后台任务代码末尾的方法(Run
方法中IBackgroundTask
)。
这是我的代码:
public sealed class TileUpdater: IBackgroundTask {
public void Run(IBackgroundTaskInstance taskInstance) {
var defferal=taskInstance.GetDeferral();
InstantSchedule();
defferal.Complete(); // <- Debugger jumps over here after error
}
public static async void InstantSchedule() {
try {
[...]
// Error occurs here
IEnumerable<LogsEntity> logentities=
account.IsAvailable
?await TableStorage.FetchLogsAsync(account.Accountname, account.AccountKey, TileUpdater.RetrieveFilter())
:null;
[...]
}
catch(Exception) {
// Debugger doesn't break here
}
}
}
谢谢