簡體   English   中英

Adrotator無法捕獲Pubcenter的“廣告未找到”異常

[英]Adrotator unable to catch Ad not found exception for Pubcenter

當前,這被捕獲在App.xaml.cs中
消息:錯誤消息:System.AggregateException:等待任務或訪問其Exception屬性,未觀察到Task的異常。 結果,未觀察到的異常被終結器線程拋出。 ---> MicrosoftAdvertising.Shared.AdException:無廣告。

如何在代碼中捕獲此異常,或者AdRotator應該處理該異常?

如果這不是已知問題,我可以共享更多代碼。

<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.
        }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM