Debugging Windows应用商店应用程序-诊断/调试打印问题(PrintTaskCompletion.Failed)

Debugging Windows应用商店应用程序-诊断/调试打印问题(PrintTaskCompletion.Failed),debugging,printing,windows-runtime,windows-store-apps,Debugging,Printing,Windows Runtime,Windows Store Apps,我正在尝试调试/查找有关如何诊断正在构建的Windows应用商店应用程序中的打印问题的文档。我查看了几个“如何在WinRT/Windows应用商店应用程序中打印”的示例,并在下面完整的处理程序中包含了常见的错误检查代码: //inside the handler passed as the second parameter into CreatePrintTask printTask.Completed += async (s, e) => { //Reset all of our

我正在尝试调试/查找有关如何诊断正在构建的Windows应用商店应用程序中的打印问题的文档。我查看了几个“如何在WinRT/Windows应用商店应用程序中打印”的示例,并在下面完整的处理程序中包含了常见的错误检查代码:

//inside the handler passed as the second parameter into CreatePrintTask
printTask.Completed += async (s, e) =>
{
    //Reset all of our internal variables (code omitted)

    if (e.Completion == PrintTaskCompletion.Failed)
    {
        await Execute.OnUiThreadAsync(async () =>
        {
            //Log Error and Show a Friendly Message to the user (code omitted)
            /*HELP - Is there anything else in the parameters passed in to the Completed event
              handler that can help specify the error?  The only thing it has is the Completion
              property; I can't seem to find any other useful data.*/

        });
    }
};
我的代码进入了
PrintTaskCompletion.Failed
位,这对于正在处理错误来说很好,但是现在我需要知道为什么它无法尝试调试该问题。我已经在这方面停留了一段时间,还没有找到任何有用的帖子/文章/书籍,告诉我如何获得更多关于所发生错误的信息,以便我可以尝试解决这个问题

如果需要更多的代码(为了简洁起见省略了很多),请让我知道。当然,请提出任何澄清问题


谢谢

我明白了我的错误发生的原因。我有一个非常微妙的错误,最终导致没有实际内容添加到
PrintDocument.AddPages
处理程序中的
PrintDocumentSource
,这导致了我的错误

我一修复那个bug,它就开始按预期工作了


詹姆斯,谢谢你提供了一个可能的解决方案

您好,这不是答案,但可能会有所帮助。我一直在看源代码,我能看到的获取错误信息的唯一方法是处理IPrintDocumentPackageStatusEvent。很遗憾,我无法从托管打印任务中注册此事件。如果使用D2D打印,则可以在创建文档包时注册此事件。我希望这有帮助-詹姆斯