目前,这在App.xaml.cs中被捕获
消息:错误消息: System.AggregateException:通过等待任务或访问其异常属性,未观察到任务的异常。因此,未观察到的异常被终结器线程重新抛出。-> MicrosoftAdvertising.Shared.AdException:没有可用的广告。
如何在代码中捕获此异常,或者AdRotator应该处理它吗?
如果这不是一个已知的问题,我可以分享更多的代码。
发布于 2015-03-30 21:49:11
<UI:AdControl Name="mainHeaderAd" IsAutoRefreshEnabled="True" ErrorOccurred="AdControl_ErrorOccurred" AdUnitId="xxx" ApplicationId="yyy" />这就是我处理AdControl异常的方式:
private void AdControl_ErrorOccurred(object sender, Microsoft.Advertising.WinRT.UI.AdErrorEventArgs e)
{
try
{
var errorType = Enum.GetName(typeof(MicrosoftAdvertising.ErrorCode), e.ErrorCode);
var adControl = sender as Microsoft.Advertising.WinRT.UI.AdControl;
// Do something with the above information.
}
catch (Exception ex)
{
// Do something with the exception.
}
}https://stackoverflow.com/questions/29335341
复制相似问题