我正在开发一个 CLR 分析器,使用CLR分析接口,并且在运行我的分析器(或至少,似乎没有加载这样的图像,但现在我不能确定)。我究竟做错了什么?ngen.exe
/profile
我已验证COR_PRF_USE_PROFILE_IMAGES
未在我的分析器中设置标志(仅允许配置文件优化的本机图像)。
以下是我尝试过的。非常感谢任何帮助/提示!
FUSLOGVW 输出:
我一直在检查本机图像活页夹日志(在FUSLOGVW.exe
)试图弄清楚图像是否已加载:
当
HelloWorld.exe
使用“普通”本机映像运行时 - 启用了探查器的 NGEN'dngen.exe install HelloWorld.exe
- 程序集活页夹日志 (ExplicitBind!FileName=(HelloWorld.exe).HTM
) 显示:Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable d:\work\dotnet\projects\HelloWorld\HelloWorld\bin\x64\Debug\HelloWorld.exe --- A detailed error log follows. WRN: Native image compile options do not match request. Looking for next native image.
因此,基于该警告,似乎未加载本机图像。
当使用配置文件图像运行时,NGEN'd with
ngen.exe install HelloWorld.exe /Profile
,图像似乎已成功加载,并且程序集活页夹输出为:LOG: Start validating all the dependencies. LOG: [Level 1]Start validating native image dependency mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Native image has correct version information. LOG: Validation of dependencies succeeded. LOG: Bind to native image succeeded. Attempting to use native image C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\HelloWorld\5647de1868c93e9132a1952a34e0a785\HelloWorld.ni.exe. Native image successfully used.
所以看来这一次,图像被加载了。
只是为了确保,在我
c:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib
为所有图像删除的每个 ngen 步骤之间,以就使用的设置达成一致(没有额外的依赖关系HelloWorld.exe
)。
附加信息:
- 我使用的是 .NET 4.0,所以我无权访问
COR_PRF_DISABLE_ALL_NGEN_IMAGES
,它完全禁用了本机图像(在David Broman的这篇博文中进行了描述)。这可能有助于故障排除。