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

时间:2014-10-29 13:34:06

标签: debugging printing windows-runtime windows-store-apps

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

//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位,这很好,正在处理错误,但现在我需要知道为什么它没有尝试调试问题。我已经坚持了一段时间,并没有找到任何有用的帖子/文章/书籍,说明如何获得有关发生的错误的更多信息,以便我可以尝试解决问题。

如果需要更多代码(为简洁省略了很多代码),请告诉我。当然,请询问任何澄清问题。

谢谢!

1 个答案:

答案 0 :(得分:0)

我弄清楚为什么我的错误发生了。我有一个非常微妙的错误,最终导致没有实际内容被添加到PrintDocumentSource处理程序中的PrintDocument.AddPages,这导致了我的错误。

一旦我修复了这个bug,它就会按预期开始工作。

谢谢,詹姆斯,提供可能的解决方案!

相关问题