Push notification 当create_任务抛出异常时,我无法在try-catch块中捕获它
我尝试接收用户的PushNotification频道URI(Windows 10平台),对于某些用户,应用程序生成异常Push notification 当create_任务抛出异常时,我无法在try-catch块中捕获它,push-notification,uwp,c++-cli,wns,Push Notification,Uwp,C++ Cli,Wns,我尝试接收用户的PushNotification频道URI(Windows 10平台),对于某些用户,应用程序生成异常,此操作返回,因为超时 要处理任务链中的错误,我应该在链的末尾添加一个基于任务的延续,并在那里处理所有错误(如这里所解释的) 所以我就这么做了。但是在我调用t.get()之后系统生成平台::COMException ^异常由它在try-catch块中未捕获。为什么? 代码如下: { create_task(PushNotificationChannelManager::C
,此操作返回,因为超时
要处理任务链中的错误,我应该在链的末尾添加一个基于任务的延续,并在那里处理所有错误(如这里所解释的)
所以我就这么做了。但是在我调用t.get()之后代码>系统生成平台::COMException ^
异常由它在try-catch块中未捕获。为什么?
代码如下:
{
create_task(PushNotificationChannelManager::CreatePushNotificationChannelForApplicationAsync())
.then([this](PushNotificationChannel^ pnChannel)
{
// ..
// DONE: pnChannel->Uri
// ..
}, task_continuation_context::get_current_winrt_context())
.then([](task<void> t)
{
try
{
t.get(); // <<<< After exec this line app crash!
}
catch (Platform::COMException^ e)
{
OutputDebugString(L"Exception catches!");
}
});
}
Visual Studio将我抛出文件c:\Program Files(x86)\Microsoft Visual Studio 14.0\VC\include\exception
,以阻止:
[[noreturn]] void _RethrowException() const
{
__ExceptionPtrRethrow(this); // <<<< here everything stoped!
}
[[noreturn]]void\u RethrowException()常量
{
__例外ptrretrow(本);//在我这边测试无法再现您的问题。请提供更多信息:您的uwp应用程序目标版本,您的测试环境。A将是首选。@Suntenwu MSFT我更新了问题并添加了环境信息和情况,当我有100%的crashI可以运行到捕获中时,请参见。调试时将引发异常,但应用程序不会出现c如果你抓到了,那就太鲁莽了。我没有一个基于coco2d-x的项目,你可以尝试用上面的代码片段创建一个空白的应用程序,然后再次测试吗?我们可以先尝试缩小问题的范围。
[[noreturn]] void _RethrowException() const
{
__ExceptionPtrRethrow(this); // <<<< here everything stoped!
}