C# Windows 10通用应用程序(UAP)中的FileNotFoundException

C# Windows 10通用应用程序(UAP)中的FileNotFoundException,c#,win-universal-app,azure-application-insights,C#,Win Universal App,Azure Application Insights,我开发并发布了一个Windows通用应用程序。为了跟踪异常和应用程序使用情况,我启用了Application Insights,我可以通过以下调用堆栈找到FileNotFoundException: at Mindapp!<BaseAddress>+0x6e58d1 at Mindapp!<BaseAddress>+0x6ee2a4 at Mindapp!<BaseAddress>+0x86bd63 --- End of stack trac

我开发并发布了一个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
在Mindapp+0x6e58d1
在Mindapp+0x6ee2a4
在Mindapp+0x86bd63
---来自引发异常的上一个位置的堆栈结束跟踪---
在Mindapp+0x6e58d1
在Mindapp+0x6ee2a4
在Mindapp+0x86d250
---来自引发异常的上一个位置的堆栈结束跟踪---
在Mindapp+0x6e58d1
在Mindapp+0x6ee2a4
在Mindapp+0x880c5e
---来自引发异常的上一个位置的堆栈结束跟踪---
在Mindapp+0x6e58d1
在Mindapp+0x6ee2a4
在Mindapp+0x8b3663
---来自引发异常的上一个位置的堆栈结束跟踪---
在Mindapp+0x6e58d1
在Mindapp+0x6ee2a4
在Mindapp+0x883601
---来自引发异常的上一个位置的堆栈结束跟踪---
在Mindapp+0x6e58d1
在Mindapp+0x6ee17e
在Mindapp+0x7d6276

不幸的是,我没有更多的信息。是否有技巧获取有关此异常的更多详细信息?

部署时,UWP应用程序将编译为.net本机应用程序。为了将上述内容变回有用的内容,您需要以下内容:

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

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

这有点乏味,但应该能完成任务


我一直在使用人工智能,最大限度地利用人工智能的关键是确保您从一开始就编写好代码,例如,您的代码应该包装在try/catch块中。然后您可以自己创建一个异常并将其发送给AI,这样您就可以控制发生的事情、位置、用户信息等,但您也可以处理错误。在我看来,这就像一个未处理的异常,在已编译的代码上,我的应用程序类似于一个图表编辑器,显然,我无法捕获每个操作。这就是为什么会有一个全局异常处理程序的原因,不是吗?我假设,filenotfound异常,会来自一个代码块,该代码块表示与打开文件有关,我猜,这是在一个函数/方法中。代码应该被包装,你实际上是在冒泡你的错误,远离创建它的方法,结果是胡说八道,因为它没有被处理。我的应用程序是针对XXX的,不是不处理错误的借口,特别是当你想对错误进行分析时。我添加了自定义异常并改进了文件处理。让我们看看,如果有帮助的话。我还有一个NullReferenceException。这将很难找到。我相信这是特定于UAP应用程序现在构建为.net本机,所以很多有用的信息现在都在异常时间消失了?
windbg -z Your.App.dll
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