Known issues in automatically generating native images


The Windows App Certification Kit lets you test your app before you submit it to the Windows Store. As part of this performance testing, the Windows App Certification Kit generates native images for all the managed assemblies (.dll and .exe files) and Windows metadata (.winmd) files that are in your app package. This ensures that the process of automatically generating native images doesn't fail on the user's computer.

This article contains information that will help you to resolve the "Native Image Generator failed" error in the "Performance test" section of the report. Specifically, it provides the following:
  • How to identify the .dll, .exe, or .winmd file that's failing, and how to get information about the failure
  • The list of known issues in automatic native image generation that may be reported by the Windows App Certification Kit for apps that are developed in Microsoft Visual Studio 2012
  • Steps for reporting new issues

Note Known issues that affect Visual Studio 2012 RC have been resolved, and are no longer included in this article. If you are still using Visual Studio 2012 RC, please install the released product.

More Information

Procedure to identify the executable file that is failing

  1. Search the following folder for the log file from the performance tests by using "Performance_Test__trace_Launch*.txt" as a wild-card search:
  2. To identify the file that caused the problem, search the log file for the "[NGenTest]ERROR" string.

    • The error message that is found by using this search identifies the file.
    • Immediately above the line that contains the error message, the log displays one or more lines of output from Ngen.exe that will help you identify the issue.
    • There may be error messages for more than one file.

Known issues in automatically generating native images

Issue: The combination of package name, executable file name, and user name is too long

Cause: Ngen.exe stores files in a user directory, which has a long path name because of the fixed parts that it includes. The combination of a long package name, a long executable file name, and a long user name can result in a path that Ngen.exe can't handle.

To identify the issue: The output from Ngen.exe indicates that there were errors compiling the native image for the following reason: "The system cannot find the path specified. (Exception from HRESULT: 0x80070003)".

  • Use a shorter package name or executable file name. The combination of the two cannot exceed 88 characters, including the file extension and a delimiter character. (This lets you use user names up to the maximum length allowed by Windows.) To view the package name in Solution Explorer, open Package.appmanifest and choose the Packaging tab.
  • If it is not possible to reduce the combined length of the two names, you can opt out of automatic native image generation by including a file named "nongen.txt" in your app package. However, we do not recommend that you do this because it may adversely affect the performance of your app.

Issue: The digital signature of a file cannot be verified because an older version was installed from Windows Store

Cause: The installer can create hard links to an executable file in multiple versions of an app. If an older version of the app was installed from the Windows Store, the installer creates links to both the older version and the current version (signed by the developer). Ngen.exe rejects the version that is signed by the developer, because it appears to come from the Windows Store.

To identify this issue: The following are true:
  • The output from Ngen.exe indicates that there were errors compiling the native image for the following reason: "Windows cannot verify the digital signature for this file."
  • Only some files in your app fail this verification.

  • Uninstall the version of your app that came from the Windows Store.
  • Uninstall any private installation of your app, including an app installation that was made as part of the product development.

Issue: Hard-bound dependencies are not yet compiled

Cause: Immediately after the operating system is installed or serviced, native images in the .NET Framework can be used by the common language runtime (CLR) but not by Ngen.exe. A critical idle task runs Ngen.exe to update the native images, after which they can be used to create additional native images. If the Windows App Certification Kit is run too soon after installation or servicing, before the critical idle task completes, Ngen.exe may fail.

To identify this issue: The output from Ngen.exe indicates that an executable file can't be compiled, because it depends on a .NET Framework assembly which is not yet compiled. The error message is similar to the following: Hardbound dependency "mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" not yet compiled, cannot compile [name and path of the executable file].

Solution: This issue affects automated test runs in which the Windows App Certification Kit is used immediately after an operating system is installed or serviced. If it occurs in non-automated scenarios, the solution is to wait for the critical idle task to complete.

In automated scenarios, you can explicitly run Ngen.exe on the .NET Framework assemblies before you run the Windows App Certification Kit (or call Ngen.exe for other reasons). Open a command window with administrative credentials, and run the following commands:
  • %WINDIR%\Microsoft.NET\Framework\v4.0.30319\ngen.exe eqi
  • %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe eqi
On 32-bit computers, run the first command. On 64-bit computers, run both commands.

Steps for reporting new issues

If you cannot work around a native image generation failure that is logged by the Windows App Certification Kit, please file a bug at the Microsoft Connect website. Specify the field values as follows:
  • Title: Use an "NGen CertKit:” prefix in the title. For example, the title might be “NGen CertKit: App certification failed for MyApplication during native image generation.”
  • Visual Studio/Silverlight/Tooling version: Enter ".NET Framework 4.5".
As a last resort, you can disable automatic native image generation for your app by including a file that is named "nongen.txt" in your app package. Be aware that doing this may adversely affect startup and execution times for your app. File a Connect bug before you take this step.

文章識別碼:2716152 - 最後檢閱時間:2013年2月1日 - 修訂: 1