LỖI NET FRAMEWORK INITIALIZATION ERROR

Feedback will be sent lớn diehmayxanh.com: By pressing the submit button, your feedbachồng will be used to improve sầu diehmayxanh.com products và services. Privacy policy.

Bạn đang xem: Lỗi net framework initialization error


In this article

The common language runtime (CLR) activation system determines the version of the CLR that will be used khổng lồ run managed application code. In some cases, the activation system might not be able to lớn find a version of the CLR khổng lồ load. This situation typically occurs when an application requires a CLR version that is invalid or not installed on a given computer. If the requested version is not found, the CLR activation system returns an HRESULT error code from the function or interface that was called, và may display an error message lớn the user who is running the application. This article provides a danh mục of HRESULT codes and explains how you can prsự kiện the error message from being displayed.

The CLR provides logging infrastructure khổng lồ help you debug CLR activation issues, as described in How to: Debug CLR Activation Issues. This infrastructure should not be confused with assembly binding logs, which are entirely different.

CLR activation HRESULT codes

The CLR activation APIs return HRESULT codes khổng lồ report the result of an activation operation to lớn a host. CLR hosts should always consult these return values before proceeding with additional operations.

CLR_E_SHIM_RUNTIMELOAD

CLR_E_SHIM_RUNTIMEEXPORT

CLR_E_SHIM_INSTALLROOT

CLR_E_SHIM_INSTALLCOMP

CLR_E_SHIM_LEGACYRUNTIMEALREADYBOUND

CLR_E_SHIM_SHUTDOWNINPROGRESS

UI for initialization errors

If the CLR activation system cannot load the correct version of the runtime that is required by an application, it displays an error message khổng lồ users to lớn inform them that their computer is not properly configured to run the application, and provides them with an opportunity to remedy the situation. The following error message is typically presented in this situation. The user can choose Yes to go to a diehmayxanh.com website where they can tải về the correct .NET Framework version for the application.

*

Resolving the initialization error

As a developer, you have sầu a variety of options for controlling the .NET Framework initialization error message. For example, you can use an API flag khổng lồ prsự kiện the message from being displayed, as discussed in the next section. However, you still have khổng lồ resolve sầu the issue that prevented your application from loading the requested runtime. Otherwise, your application may not run at all, or some functionality may not be available.

To resolve the underlying issues and provide the best user experience (fewer error messages), we recommover the following:

Controlling the error message

Displaying an error message khổng lồ communicate that a requested .NET Framework version was not found can be viewed as either a helpful service or a minor annoyance lớn users. In either case, you can control this UI by passing flags lớn the activation APIs.

Xem thêm: Hướng Dẫn Cài Đặt Half Life Cs 1, Download Half Life 1

The ICLRMetaHostPolicy::GetRequestedRuntime method accepts a METAHOST_POLICY_FLAGS enumeration thành viên as đầu vào. You can include the METAHOST_POLICY_SHOW_ERROR_DIALOG flag to lớn request an error message if the requested version of the CLR is not found. By mặc định, the error message is not displayed. (The ICLRMetaHost::GetRuntime method does not accept this flag, & does not provide any other way to display the error message.)

Windows provides a SetErrorMode function that you can use to lớn declare whether you want error messages lớn be shown as a result of code that runs within your process. You can specify the SEM_FAILCRITICALERRORS flag to lớn prsự kiện the error message from being displayed.

However, in some scenarios, it is important to lớn override the SEM_FAILCRITICALERRORS setting phối by an application process. For example, if you have a native COM component that hosts the CLR and that is hosted in a process where SEM_FAILCRITICALERRORS is mix, you may want lớn override the flag, depending on the impact of displaying error messages within that particular application process. In this case, you can use one of the following flags lớn override SEM_FAILCRITICALERRORS:

UI policy for CLR-provided hosts

The CLR includes a phối of hosts for a variety of scenarquả táo, và these hosts all display an error message when they encounter problems loading the required version of the runtime. The following table provides a list of hosts and their error message policies.

CLR hostDescriptionError message policyCan error message be disabled?
Managed EXE hostLaunches managed EXEs.Is shown in case of a missing .NET Framework versionNo
Managed COM hostLoads managed COM components into lớn a process.Is shown in case of a missing .NET Framework versionYes, by setting the SEM_FAILCRITICALERRORS flag
ClickOnce hostLaunches ClickOnce applications.Is shown in case of a missing .NET Framework version, starting with the .NET Framework 4.5No
XBAP hostLaunches WPF XBAP.. applications.Is shown in case of a missing .NET Framework version, starting with the .NET Framework 4.5No

Windows 8 behavior và UI

The CLR activation system provides the same behavior & UI on Windows 8 as it does on other versions of the Windows operating system, except when it encounters issues loading CLR 2.0. Windows 8 includes the .NET Framework 4.5, which uses CLR 4.5. However, Windows 8 does not include the .NET Framework 2.0, 3.0, or 3.5, which all use CLR 2.0. As a result, applications that depkết thúc on CLR 2.0 bởi vì not run on Windows 8 by default. Instead, they display the following dialog box to enable users to install the .NET Framework 3.5. Users can also enable the .NET Framework 3.5 in Control Panel. Both options are discussed in the article Install the .NET Framework 3.5 on Windows 11, Windows 10, Windows 8.1, and Windows 8.