다음을 통해 공유


Assembly Binding Log Viewer (Fuslogvw.exe)

One of the most difficult aspects of working with localized resources is debugging the process of loading those resources. When using a ResourceManager, resource requests are handed off to the common language runtime, which is responsible for locating, loading, and binding to that resource. In your source code, a single call to load a resource might execute a number of binding requests to the common language runtime.

The Assembly Binding Log Viewer helps to analyze the resource-loading process. Detailed resource-binding information is actually maintained on a per-URL basis by the WinInet component of Windows. Unfortunately, when WinInet returns those entries, they are not necessarily in chronological order.

By default, binding calls are not logged. To turn on logging, it is first necessary to create a DWORD value under the HKLM\Software\Microsoft\Fusion key in the Windows registry. The first level of logging displays only failed resource bindings. To enable this, you must create a LogResourceBinds DWORD value, and set its value to something other than the default of zero.

You can cause a resource-binding failure in the sample application by simply deleting or renaming an appropriate resource satellite assembly. For example, if you delete both \en-US\Graphic.resources.dll and \en\Graphic.resources.dll and then run the Graphic sample, FusLogVW produces the log that is shown in the following figure:

These two log entries indicate that, first, the common language runtime attempted to locate a resource for the en-US culture. Failing that, it attempted to load a resource for the en culture. Failing that, it finally loaded a resource from the main assembly (which, because it was successful, was not logged).

Many developers, however, want to see all binding activity. In that case, it is necessary to set the DWORD value of ForceLog to something other than the default of zero. At that point, subsequent binding calls — both successes and failures — will be logged. The following figure shows a typical log:

Selecting one of the resource bindings (in this case, for Locale=en-US) and clicking View Log opens a browser window and produces the detailed log that is shown in the following figure.

This particular log entry shows that the resource was successfully loaded after the common language runtime searched the Global Assembly Cache (GAC) and the application subdirectories. To reduce the number of files that the common language runtime attempts to load — and to increase performance — the common language runtime attempts to locate the resources only in files with .dll extensions.