【问题标题】:FileNotFoundException in Windows 10 Universal App (UAP)Windows 10 通用应用程序 (UAP) 中的 FileNotFoundException
【发布时间】:2016-02-07 22:20:27
【问题描述】:

我开发并发布了一个 Windows 通用应用程序。为了跟踪异常和应用程序使用情况,我启用了 Application Insights,我可以通过以下调用堆栈找到 FileNotFoundException:

   at Mindapp!<BaseAddress>+0x6e58d1
   at Mindapp!<BaseAddress>+0x6ee2a4
   at Mindapp!<BaseAddress>+0x86bd63
--- End of stack trace from previous location where exception was thrown ---
   at Mindapp!<BaseAddress>+0x6e58d1
   at Mindapp!<BaseAddress>+0x6ee2a4
   at Mindapp!<BaseAddress>+0x86d250
--- End of stack trace from previous location where exception was thrown ---
   at Mindapp!<BaseAddress>+0x6e58d1
   at Mindapp!<BaseAddress>+0x6ee2a4
   at Mindapp!<BaseAddress>+0x880c5e
--- End of stack trace from previous location where exception was thrown ---
   at Mindapp!<BaseAddress>+0x6e58d1
   at Mindapp!<BaseAddress>+0x6ee2a4
   at Mindapp!<BaseAddress>+0x8b3663
--- End of stack trace from previous location where exception was thrown ---
   at Mindapp!<BaseAddress>+0x6e58d1
   at Mindapp!<BaseAddress>+0x6ee2a4
   at Mindapp!<BaseAddress>+0x883601
--- End of stack trace from previous location where exception was thrown ---
   at Mindapp!<BaseAddress>+0x6e58d1
   at Mindapp!<BaseAddress>+0x6ee17e
   at Mindapp!<BaseAddress>+0x7d6276

很遗憾,我没有更多信息。是否有技巧可以获取有关此异常的更多详细信息?

【问题讨论】:

  • 我一直在使用 AI,充分利用它的关键是确保从一开始就写出好的代码,例如,你的代码应该包含在 try / catch 块中.然后,您可以自己创建一个异常并将其发送给 AI,这样您就可以控制发生的事情、位置、用户信息等,但您也在处理错误。这在我看来就像一个未处理的异常,在编译代码上
  • 我的应用程序有点像图表编辑器,我显然无法捕捉到每个操作。这就是为什么有一个全局异常处理程序的原因,不是吗?
  • 我会假设,filenotfound 异常,将来自一段与打开文件有关的代码,我的猜测是,这是在函数/方法中。该代码应该被包装,你实际上是在冒泡你的错误,远离创建它的方法,并以废话结束,因为它没有被处理。我的申请是为 XXX 申请的,这不是不处理错误的借口,尤其是当您想对错误进行分析时
  • 我添加了自定义异常并改进了文件处理。让我们看看,如果它有帮助。我在某处也有 NullReferenceException。这将很难找到。
  • 我相信这是特定于现在构建为 .net 本机的 UAP 应用程序,所以很多有用的信息现在在异常时消失了?

标签: c# win-universal-app azure-application-insights


【解决方案1】:

部署后,UWP 应用程序编译为 .net 本机。为了把上面的东西变成有用的东西,你需要像这里这样的东西:https://social.msdn.microsoft.com/Forums/en-US/529e6655-bbf2-4ffa-8dcb-b2691327c389/how-to-translate-stack-traces-from-net-native

不幸的是,如果您所拥有的只是带有地址的堆栈跟踪,那么就没有一个很好的自动解决方案。您可以使用本地 Windows 调试器手动解码信息,方法是将应用程序 dll 打开为“转储”:

windbg -z Your.App.dll

然后您可以发出 lm 命令在调试器中查找 DLL 的基地址,并发出 ln 命令将每个 +offset 位置转换回一个符号(假设您手边有 PDB)。

0:000> lm m My.App
start             end                 module name
00000000`00400000 00000000`00a08000   My.App   C (private pdb symbols)  My.App.pdb

0:000> ln 0x00400000+0x00021cc4
(00000000`00421cc4)   My.App!RHBinder__DllMain

这有点乏味,但应该可以完成工作。

【讨论】:

    猜你喜欢
    • 2016-11-11
    • 2015-11-09
    • 2015-11-04
    • 1970-01-01
    • 2015-11-30
    • 1970-01-01
    • 1970-01-01
    • 2015-12-15
    • 1970-01-01
    相关资源
    最近更新 更多