|
| 1 | +# .NET Framework 4.6 - Testing with RyuJIT |
| 2 | + |
| 3 | +The .NET Framework 4.6 includes new Just-In-Time (JIT) compiler for 64-bit processes, called RyuJIT. It is enabled by default. It is still a preview version, so you may discover issues that have yet to be fixed. |
| 4 | + |
| 5 | +You may experience the following symptoms when you use the new JIT compiler: |
| 6 | + |
| 7 | +* An application throws an `InvalidProgramException` error. |
| 8 | +* An application works on an x86-based computer but not on an x64-based |
| 9 | + computer. |
| 10 | + |
| 11 | +## Workarounds for JIT Compilation |
| 12 | + |
| 13 | +To work around this problem, use any one of the following methods. |
| 14 | + |
| 15 | +**Important** Follow the steps in this section carefully. Serious problems might |
| 16 | +occur if you modify the registry incorrectly. Before you modify it, |
| 17 | +[back up the registry](http://support.microsoft.com/kb/322756) for restoration |
| 18 | +in case problems occur. |
| 19 | + |
| 20 | +**Note** For all these methods, all dynamic compilation is performed by the older |
| 21 | +JIT64 JIT. Also, all NGEN compilation continues to use the new JIT, and all |
| 22 | +existing NGEN images that have been compiled by the new JIT continue to be used. |
| 23 | + |
| 24 | +* **Method 1**. Set the following environment variable: |
| 25 | + |
| 26 | + COMPLUS_useLegacyJit=1 |
| 27 | + |
| 28 | +* **Method 2**. In the registry, create either of the following subkeys: |
| 29 | + |
| 30 | + HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework |
| 31 | + HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework |
| 32 | + |
| 33 | + Then, specify the following: |
| 34 | + |
| 35 | + Key name: useLegacyJit |
| 36 | + Type: REG_WORD |
| 37 | + Value: 1 |
| 38 | + |
| 39 | +* **Method 3**. Add the following text to the `<app>.exe.config file`. Create |
| 40 | + the indicated sections if they do not already exist. |
| 41 | + |
| 42 | + **Note** In this file name, `<app>` represents the actual name of the |
| 43 | + application. |
| 44 | + |
| 45 | + <configuration> |
| 46 | + <runtime> |
| 47 | + <useLegacyJit enabled="1"> |
| 48 | + </runtime> |
| 49 | + </configuration> |
| 50 | + |
| 51 | +## Workarounds for NGEN Compilation |
| 52 | + |
| 53 | +If you encounter a bug when you use the new JIT, and if the bug manifests itself |
| 54 | +as an NGEN image, use any of the following methods to force certain named |
| 55 | +assemblies to be recompiled by the JIT and not use the existing native images: |
| 56 | + |
| 57 | +* **Method 1**. Set the following environment variable: |
| 58 | + |
| 59 | + COMPLUS_DisableNativeImageLoadList=assembly_one;assembly_two;assembly_three |
| 60 | + |
| 61 | +* **Method 2**. In the registry, create either of the following subkeys: |
| 62 | + |
| 63 | + HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework |
| 64 | + HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework |
| 65 | + |
| 66 | + Then, specify the following: |
| 67 | + |
| 68 | + Key name: DisableNativeImageLoadList |
| 69 | + Type: REG_SZ |
| 70 | + Value: assembly_one;assembly_two;assembly_three |
| 71 | + |
| 72 | + **Note** This is a semicolon-delimited or space-delimited list of simple |
| 73 | + assembly names (no public key token, no architecture, and so on). This list |
| 74 | + does not contain the `.dll` file name extension. In the examples in this |
| 75 | + method and the next method, `assembly_one` is the simple name for an assembly |
| 76 | + that is named `assembly_one.dll`. |
| 77 | + |
| 78 | +* **Method 3**. Add the following text to the `<app>.exe.config` file. Create |
| 79 | + the indicated sections if they do not already exist. |
| 80 | + |
| 81 | + **Note** In this file name, `<app>` represents the actual name of the |
| 82 | + application. |
| 83 | + |
| 84 | + <configuration> |
| 85 | + <runtime> |
| 86 | + <disableNativeImageLoad> |
| 87 | + <assemblyIdentity name="assembly_one" /> |
| 88 | + <assemblyIdentity name="assembly_two" /> |
| 89 | + </disableNativeImageLoad> |
| 90 | + </runtime> |
| 91 | + </configuration> |
0 commit comments