c# - 小型转储中的 .ni.dll 和 .ni.exe 文件是什么?

标签 c# windows-store-apps windbg windows-store

由于我的应用程序崩溃,我从 Windows 应用商店应用程序提交过程(由审阅者发送)中获得了一个小型转储。我在为我的应用程序加载符号时遇到问题,因为错误发生在 App.ni.exe 中,这是一个我不知道从哪里来的文件。

我的应用程序只有一个 App.exe(和一些 DLL),但转储一直引用 .ni.dll.ni.exe。在我的 .appx.appxsym 文件中找不到这些文件。

我的应用是为每个特定平台(x86、x64 和 ARM)构建的。堆栈转储中崩溃的是 x64 版本。

我目前对 windbg 的尝试:

符号路径:

Srv*C:\Users\Vegard\Appdata\local\temp\SymbolCache*http://msdl.microsoft.com/download/symbols`

Windbg 尝试:

0:006> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

Unable to load image Newtonsoft.Json.ni.dll, Win32 error 0n2
*** WARNING: Unable to verify checksum for Newtonsoft.Json.ni.dll
*** ERROR: Module load completed but symbols could not be loaded for Newtonsoft.Json.ni.dll
Unable to load image App.ni.exe, Win32 error 0n2
*** WARNING: Unable to verify checksum for App.ni.exe
*** ERROR: Module load completed but symbols could not be loaded for App.ni.exe
Unable to load image mscorlib.ni.dll, Win32 error 0n2
*** WARNING: Unable to verify checksum for mscorlib.ni.dll

更新:尝试 ngen App.exe(以管理员身份运行)时出现以下错误:

> ngen.exe install App.exe
[snip]
This operation is only valid in the context of an app container. 
(Exception from HRESULT: 0x8007109A)

在这种情况下什么是应用程序容器?我应该从哪里运行它?

更新:经过长时间的故障排除,并通过其他方式找出根本原因,我得出结论,我得到的小型转储文件缺少此信息。无论如何哄骗都可以让调试器加载文件的符号。

最佳答案

看看工具说明Ngen.exe (Native Image Generator) :

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead of using the just-in-time (JIT) compiler to compile the original assembly.

请记住这个特定于处理器的机器代码

如果您需要使用 NI 图像调试小型转储,您需要获取这些图像的符号 (PDB)。托管 DLL 的 PDB 将不起作用,您需要使用 NGEN 工具为 NGEN 的图像生成 native PDB,查看文章 Creating NGEN PDBs for Profiling Reports .这篇文章是关于如何为 Profiler Report 获取 NGEN pdbs,但对于调试它是一样的。

正如我所说,请记住 NGEN 是一个特定于处理器的机器代码,因此要为它们生成 PDB:

Since NGEN’d images are native, it’s important you use the copy of ngen.exe that matches the architecture of the application you are profiling (x86/x64/ARM). For example if the application is running 64 bit on Windows 8 RTM then you would need to reference the copy of ngen.exe in “C:\Windows\Microsoft.NET\Framework64\v4.0.30319”

更新:

来自link以上:

if you remote profiled a Windows Store App, you have to do this on the machine you were running the app on while you were profiling. It will not work if you do it on the machine you are viewing the report on

所以看起来您需要在获得小型转储的同一台机器上生成 ngen 模块/pdb。

Windows 有一个 Native Image Service ,它会在您将其安装到计算机上一段时间后为 Windows 应用商店应用程序生成 ni 图像。你可以尝试使用procmon.exe了解 Windows 如何为来自 Windows 应用商店的应用程序生成 ngen 模块。 (只需使用带有 ngen.exe 的进程名称过滤器)。

关于c# - 小型转储中的 .ni.dll 和 .ni.exe 文件是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15894662/

相关文章:

c# - Windows Phone 7 和 Windows Phone 8/Windows 8(Windows 应用商店)之间的代码共享

debugging - 在故障转储中获取堆栈的时间戳

c - 如何查看 LPVOID 类型变量的内容

c# - 我们如何在 Windows Phone 8 中将相机作为背景 View 运行?

c# - 如何分离 View 数据和 ViewModel 数据?

c# - 使用 Roslyn 从属性中获取类型

c# - 如何在触摸屏中滚动 ListView

xaml - 为 Windows 应用商店应用学习 xaml 的最佳资源?

c# - Bing map 与 C# 和 MVVM 信息框和图钉绑定(bind)

c++ - 如何在应用程序一开始就破坏堆栈