用户从打印对话框取消XPS保存时,对ReleaseHandleFailed的操作失败 [英] What to do about ReleaseHandleFailed when user cancels an XPS save from print dialog

查看:98
本文介绍了用户从打印对话框取消XPS保存时,对ReleaseHandleFailed的操作失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的WPF应用程序中,我调用printDialog.PrintDocument并为其提供一个我定义的分页器对象和一个描述字符串.效果很好,但是我注意到,如果用户选择XPS格式,然后取消XPS名称/保存对话框,则在Visual Studio中进行调试时, 我得到一个ReleaseHandleFailed警告对话框,该对话框的描述说我可能有某种类型的句柄(SafeHandle或CriticalHandle,在我的解决方案中从未提到过),并且没有对其进行处理.

In my WPF app, I call printDialog.PrintDocument and give it a paginator object I defined and a description string. Works well enough, but I notice that if the user selects XPS format and then cancels the XPS name/save dialog, when debugging in Visual Studio, I get a ReleaseHandleFailed warning dialog, the description of which says I may have some sort of handle (SafeHandle or CriticalHandle, which are never mentioned anywhere in my solution) and not disposed of it.

即:

类型为MS.Internal.Printing.Configuration.SafePTProviderHandle的SafeHandle或CriticalHandle"无法正确释放值为0x0046A580的句柄.这通常表示手柄是通过其他方式(例如, 使用DangerousGetHandle提取句柄并直接将其关闭或在其周围构建另一个SafeHandle.)"

"A SafeHandle or CriticalHandle of type 'MS.Internal.Printing.Configuration.SafePTProviderHandle' failed to properly release the handle with value 0x0046A580. This usually indicates that the handle was released incorrectly via another means (such as extracting the handle using DangerousGetHandle and closing it directly or building another SafeHandle around it.)"

因此,我不知道该警告该怎么办,除非假定它不是真正的问题,然后忽略它.是的?有人知道吗?谢谢.

So I have no idea what to do about this warning except assume it is not really a problem and ignore it. Yes? Anyone know about this? Thanks.

推荐答案

您好Galfonz,

Hi Galfonz,

您使用什么版本的VS? VS2010还是VS2008?

What the version of VS you are using with? VS2010 or VS2008?

您能在这里发布一些代码让我们看看吗?我们需要建立一个完整的可复制项目以进行调试.

Could you post some code up here for us to have a look at? We need to build up a complete reproducible project to debug with.

最诚挚的问候


这篇关于用户从打印对话框取消XPS保存时,对ReleaseHandleFailed的操作失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆