RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.
When running a Microsoft .NET application, it crashes with a FatalExecutionEngineException and the process terminates unexpectedly. When installing a Microsoft .NET application, you receive the following error.
".Net Runtime Optimization Service has encountered a problem and needs to close. "
When this occurs, the application event log may report the following error:
This behavior can occur if the native images for .NET assemblies have been modified or corrupted. It is typical for third party memory optimization tools to rebase DLL load addresses in native images. Rebasing DLL load addresses in a native image can put the image in an unexpected state, which causes the Common Language Run-time (CLR) to encounter an Access Violation. The CLR detects the Access Violation and then terminates the process with a FatalExecutionEngineException since the process is in an unexpected state.
Note that if core .NET Framework assemblies installed in the Global Assembly Cache (GAC) are modified, it could cause any .NET application running on the system to crash unexpectedly.
Identify and disable any external memory optimization tools that rebase DLL load addresses.
If you are unaware whether modified native images are the cause of the problem, you should try the steps in the "WORKAROUND" section below to see if it resolves the problem. If that resolves the problem and you are unable to determine what tool may be modifying assemblies in the native image cache, the SysInternals Process Monitor tool is a good way to determine that. By using Process Monitor, you can monitor file I/O activity (primarily File Write activity) that is going on to anything located under the native image cache. The native image cache is located at <windows folder>\assembly\NativeImages_v2.0.50727_32. This should allow you to see what EXE may be modifying it, and then you can disable it from doing so. For more information on Process Monitor, please visit the following website.
WORKAROUND ============== You may be able to work around the problem for .NET assemblies in the GAC by resetting the native image cache. Note this may only be a temporary solution. If any external rebasing tool(s) are enabled, it is likely they would modify the images in the native image cache again.
To reset the native image cache, follow these steps:
1. Start a new command prompt on the system exhibiting the problem. If you are running Windows Vista or Windows 2008, you must start an elevated command prompt. 2. Navigate to the .NET Framework folder under the \Windows folder.
MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.