我正在编写调用以下方法的代码,该方法存在于Windows.Networking.PushNotifications
中。
// Summary:
// Creates objects that you use to retrieve push notification channels from
// the Windows Push Notification Services (WNS). These channels are bound to
// an app or secondary tile.
[Threading(ThreadingModel.MTA)]
[Version(100794368)]
public static class PushNotificationChannelManager
{
// Summary:
// Creates an object, bound to the calling app, through which you retrieve a
// push notification channel from Windows Push Notification Services (WNS).
//
// Returns:
// The object, bound to the calling app, that is used to request a PushNotificationChannel
// from the Windows Push Notification Services (WNS).
[Overload("CreatePushNotificationChannelForApplicationAsync")]
public static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync();
}
我希望确保涵盖所有可能会引发异常的情况,并适当地处理每种情况。请问是否可以给我列出可能引发的不同类型异常以及可能导致它们的不同情况?
我不想只使用一个catch语句来捕获所有异常。
catch(Exception ex) { }
这篇MSDN文章指出:“如果在没有数据连接时尝试注册WNS推送通知通道,会抛出异常。”然而它并未说明异常类型或是否存在其他可能引发异常的情况。 我该如何确定是否存在其他可能的异常类型?