Bind the assembly to the log viewer (Fuslogvw.exe)

Source: Internet
Author: User

The Assembly Binding Log Viewer displays detailed information about assembly binding. This information helps you diagnose why. NET Framework cannot find the Assembly at runtime. These failures are usually caused by the following factors: the Assembly deployed to the wrong location, the native image that is no longer valid, the version number, or the regional mismatch. If the common language runtime fails to find the assembly, it usually appears as TypeLoadException in your application.

View the Assembly Binding log Content
  • Run Fuslogvw.exe from the SDK command prompt.

The viewer displays an item for each failed assembly binding. For each failure, the viewer describes the application to which the binding is started, the target assembly (including name, version, culture, and Public Key) to be bound, and the date and time of the failure.

Change log location View
  1. Select"Default"Option Button to view all application types failed to bind. By default, log entries are stored in the user-based directory in the wininet cache on the disk.

  2. Select"Custom"You can view the binding Failure Information in the Custom directory you specified. You must specify the custom location where you want the Runtime Library to store logs"Log Settings"In the dialog box, set the custom log location to a valid directory name. This directory should be clean and only contain files generated by the runtime. If the directory contains an executable file that will generate records of failures, the failure will not be recorded, this tool tries to create a directory with the same name as the executable file. In addition, an attempt to run executable files from the log location fails.

    Note:

    The default binding location is better than the custom binding location. The runtime stores the default binding location in the wininet cache, so that the location can be automatically cleared. If you specify a custom binding location, you need to clear it by yourself.

View details about specific failures
  1. Select the name of the application in the viewer.

  2. Click"View Log"Button. Alternatively, you can double-click the selected option.

    The tool displays the following details about failed binding:

    • The reason for binding failure, such as "file not found" or "version mismatch ".

    • Information related to the application that starts the binding, including its name, application root directory (AppBase), and description of the dedicated search path (if such a path exists ).

    • The identifier of the Assembly that the tool is looking.

    • Description of any application, publisher, or administrator Version policies that have been applied.

    • Whether the assembly is found in the global assembly cache.

    • List of all the URLs being tested.

The following example shows detailed information about failed assembly binding.

Copy code
*** Assembly Binder Log Entry  (3/5/2007 @ 12:54:20 PM) ***The operation failed.Bind result: hr = 0x80070002. The system cannot find the file specified.Assembly manager loaded from:  C:\WINNT\Microsoft.NET\Framework\v2.0.50727\fusion.dllRunning under executable  C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\graphic\cs\graphicfailtest.exe--- A detailed error log follows.=== Pre-bind state information ===LOG: DisplayName = graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=null(Fully-specified)LOG: Appbase = C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\Tutorials\resourcesandlocalization\graphic\cs\LOG: Initial PrivatePath = NULLLOG: Dynamic Base = NULLLOG: Cache Base = NULLLOG: AppName = NULLCalling assembly : graphicfailtest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.===LOG: Processing DEVPATH.LOG: DEVPATH is not set. Falling through to regular bind.LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).LOG: Post-policy reference: graphicfailtest.resources, Version=0.0.0.0, Culture=en-US, PublicKeyToken=nullLOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources.DLL.LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources/graphicfailtest.resources.DLL.LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources.EXE.LOG: Attempting download of new URL file:///C:/Program Files/Microsoft.NET/FrameworkSDK/Samples/Tutorials/resourcesandlocalization/graphic/cs/en-US/graphicfailtest.resources/graphicfailtest.resources.EXE.LOG: All probing URLs attempted and failed.
Delete a single item from the log
  1. Select an item in the viewer.

  2. Click"Delete Entry"Button.

Delete all items from logs
  • Click"Delete All"Button.

Refresh user interface
  • Click"Refresh"Button. The viewer does not automatically detect new log entries when it is running. You must use"Refresh"Button to display them.

Change log settings
  • Click"Settings"Open button"Log Settings"Dialog box.

View "About" dialog box
  • Click"About"Button.

Local Image binding logs

Fuslogvw.exe records Common Assembly binding requests. In addition, you can record the Assembly binding of the local image created using the local image generator (Ngen.exe.

Record assembly binding for local Images
  • In"Log category"Group, select"Local Image"Option Button.

The following log shows a failure caused by a dependency. This dependency does not exist when creating a local image for the application. If the runtime dependency is different from the Ngen.exe runtime dependency, you cannot bind the dependency to the local image.

Copy code
*** Assembly Binder Log Entry  (12/8/2006 @ 5:22:07 PM) ***The operation failed.Bind result: hr = 0x80070002. The system cannot find the file specified.Assembly manager loaded from:  E:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dllRunning under executable  E:\test\App.exe--- A detailed error log follows.LOG: Start binding of native image App, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.LOG: IL assembly loaded from E:\test\App.exe.LOG: Start validating native image App, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.LOG: Start validating all the dependencies.LOG: [Level 1]Start validating native image dependency mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.LOG: Dependency evaluation succeeded.LOG: [Level 1]Start validating IL dependency b, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.WRN: Dependency assembly was not found at ngen time, but is found at binding time. Disallow using this native image.WRN: No matching native image found.LOG: Bind to native image assembly did not succeed. Use IL image.

The following log shows that a local image binding failure occurs because the security settings on the computer when the application is running are different from those when the local image is created.

Copy code
*** Assembly Binder Log Entry  (12/8/2006 @ 5:29:09 PM) ***The operation failed.Bind result: hr = 0x80004005. Unspecified errorAssembly manager loaded from:  E:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dllRunning under executable  E:\test\Application101622.exe--- A detailed error log follows.LOG: Start binding of native image Application101622, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.LOG: IL assembly loaded from E:\test\Application101622.exe.LOG: Start validating native image Application101622, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.LOG: Start validating all the dependencies.LOG: [Level 1]Start validating native image dependency mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.LOG: Dependency evaluation succeeded.LOG: [Level 1]Start validating IL dependency Dependency101622, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.LOG: Dependency evaluation succeeded.LOG: Validation of dependencies succeeded.LOG: Start loading all the dependencies into load context.LOG: Loading of dependencies succeeded.LOG: Bind to native image succeeded.Native image has correct version information.Attempting to use native image E:\Windows\assembly\NativeImages_v2.0.50727_64\Application101622\1ac7fadabec4f72575d807501e9fdc72\Application101622.ni.exe.Rejecting native image because it failed the security check. The assembly's permissions must have changed since the time it was ngenned, or it is running with a different security context.Discarding native image.
"Log Settings" dialog box

Available"Log Settings"Dialog Box to perform the following operations.

Disable Logging
  • Select"Log disabled"Option Button. Note: This option is selected by default.

Record assembly binding in exception
  • Select"Log in exception text"Option Button.

    See the "important things" about the Assembly loaded in a non-specific domain.

Failed to record Assembly Binding
  • Select"Log bind failures to disk"Option Button.

    See the "important things" about the Assembly loaded in a non-specific domain.

Record all Assembly bindings
  • Select"Log all binds to disk"Option Button.

    See the "important things" about the Assembly loaded in a non-specific domain.

Important:

When the Assembly is loaded in a non-specific domain (for example, set the LoaderOptimization attribute to LoaderOptimization .. ::. multiDomain or LoaderOptimization .. ::. multiDomainHost). Opening a log may expose the memory in some cases. If a log entry is recorded when a non-domain-specific module is loaded into an application domain, and then the application domain is uninstalled, memory leakage may occur. This log entry may not be released before the process ends. Some debuggers automatically open logging.

Enable custom Log Path
  1. Select"Enable custom log path"Option Button.

  2. In"Custom log path"Enter the path in the text box.

Note:

The Assembly Binding Log Viewer (Fuslogvw.exe) uses Internet Explorer (IE) cache to store its binding logs. Due to occasional corruption in the IE cache, the Assembly Binding Log Viewer (Fuslogvw.exe) Sometimes stops displaying new binding logs in the viewing window. Affected by this damage,. NET binding infrastructure (merging) will not be able to write or read binding logs. (If you use a custom log path, this problem is not encountered .) To repair damaged data and allow merging to display the binding log again, delete the Temporary Internet file in the Internet Options dialog box of IE to clear the IE cache.

If an unmanaged application implements the IHostAssemblyManager and IHostAssemblyStore interfaces to become the host of the Common Language Runtime Library, log entries cannot be stored in the wininet cache. To view the log entries of the custom host implementing these interfaces, you must specify an alternative Log Path.

See

Concept: how to locate an assembly in the Global Assembly Cache Runtime

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.