本文介绍了[UWP]使用System.UnauthorizedAccessException保存文件偶尔会失败:访问被拒绝。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在桌面上运行了一个基本的UWP应用程序。偶尔我收到来自用户的错误报告抱怨保存他们的文件失败并出现此错误:


System.UnauthorizedAccessException:访问被拒绝。 (Excep_FromHResult 0x80070005)

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   在SharedLibrary!< BaseAddress> + 0x4511ee

   在SharedLibrary!< BaseAddress> + 0x451168

   在SharedLibrary!< BaseAddress> + 0x50c81a

    at System.Action.Invoke()

---从抛出异常的上一个位置开始的堆栈跟踪结束---

    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   在SharedLibrary!< BaseAddress> + 0x4511ee

   在SharedLibrary!< BaseAddress> + 0x451168

   在SharedLibrary!< BaseAddress> + 0x50c81a


有没有人遇到过类似的问题?这似乎是在随机时间发生的,即用户无法可靠地再现它。保存工作大部分时间,但不是所有时间,这是一个问题...


以下是我认为引发错误的行:


  &NBSP;  (StorageFile):tempZipFile.MoveAndReplaceAsync(this.zipFile).AsTask()。GetAwaiter()。GetResult();


Any想法我能检查什么?我计划通过添加的调试信息向我的应用发布更新。 


谢谢!


解决方案


I have a basic UWP app running on the desktop. Once in a while I receive error reports from users complaining that saving their files fails with this error:

System.UnauthorizedAccessException: Access is denied. (Excep_FromHResult 0x80070005)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at SharedLibrary!<BaseAddress>+0x4511ee
   at SharedLibrary!<BaseAddress>+0x451168
   at SharedLibrary!<BaseAddress>+0x50c81a
   at System.Action.Invoke()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at SharedLibrary!<BaseAddress>+0x4511ee
   at SharedLibrary!<BaseAddress>+0x451168
   at SharedLibrary!<BaseAddress>+0x50c81a

Did anybody ever run into a similar problem? This seems to happen at random times, i.e. users can't reliably reproduce it. Saving works most of the time, but not all the time, which is a problem...

Here is the line of which I think is throwing the error:

     (StorageFile): tempZipFile.MoveAndReplaceAsync(this.zipFile).AsTask().GetAwaiter().GetResult();

Any ideas what I could check for? I'm planning to release an update to my app with added debug information. 

Thanks!

解决方案


这篇关于[UWP]使用System.UnauthorizedAccessException保存文件偶尔会失败:访问被拒绝。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 18:18