FileOpenPicker PickSingleFileAsync引发UnauthorizedAccessException [英] FileOpenPicker PickSingleFileAsync throws UnauthorizedAccessException

查看:105
本文介绍了FileOpenPicker PickSingleFileAsync引发UnauthorizedAccessException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于

当我通过按钮触发它时,我从最后一行得到以下异常:

When I trigger it from a button I get the following exception from the last line:

System.UnauthorizedAccessException
访问被拒绝. (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))

System.UnauthorizedAccessException
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

我认为在这种用法中使用FileOpenPicker的想法是,我不需要询问用户访问权限或指定任何功能?

I thought the idea of the FileOpenPicker in this usage was that I didn't need to ask the user for access permissions or specify any capabilities?

推荐答案

我在调用PickSingleFileAsync()之前设置了一个断点.事实证明,在边框内按下TextBlock时会触发两个轻击事件(两者都具有相同的轻击事件处理程序).

I set a breakpoint just before the call to PickSingleFileAsync(). Turns out that two tapped events were being fired when pressing a TextBlock within a Border (both with the same Tapped event handler).

第一个调用按预期工作,但随后的调用导致UnauthorizedAccessException,并且将在显示选择器后立即发生.

The first call worked as expected, but subsequent call resulted in the UnauthorizedAccessException and would occur straight after the picker was displayed.

这篇关于FileOpenPicker PickSingleFileAsync引发UnauthorizedAccessException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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