New Message on dotNET User Group Hyd

Article : Fuslogvw.exe -- Excellent Tool (.Net FrameWork Tools Series)

Reply
  Reply to Sender   Recommend Message 1 in Discussion
From: Nasha

Hey Group,

All us of us has had issues with assembly binding, but very few of us know about the assembly binding viewer. This is a utility tool which is packaged along with the .Net FrameWork Tools. This utility tool allows you to view all assembly bindings of an application.In case there is a failure then the failure can be logged and you can view the log later. This log gives a complete discription of the failure.

Let us get started with fuslogvw aka Assembly binding viewer.

1) Create three dot net projects one a class library called BindiingDLL , one a Console App called BindingConsoleClient and other one a Web Application know as WebBindingClient.

2) The console app and the web app will have a reference to the class library.

3) Create a method in the Class Library project called as Add which simply add's two numbers and returns the result

public int Add (int i ,int j)

{

return i + j;

}

4) Build the DLL.

5) In the Console App call the Add function in its main.

[STAThread]

static void Main(string[] args)

{

BindingDLL.classBind bindingObj = new BindingDLL.classBind();

Console.WriteLine(bindingObj.Add(1,2).ToString());

Console.ReadLine();

}

6) Build and execute the application. The application should run smoothly.Stop the application.

7) For the viewer to log all the results we need to add certain keys in the registry. Most of the machine I have seen dont have these keys. If your machine has then simply change its value else create a new DWORD key named ForceLog. The value of this key should be greater than 0.

==> HKLM\Software\Microsoft\Fusion\ForceLog

8) Go to VS.Net command prompt and type fuslogvw.

9) The application starts this utility has 3 columns Application,Description and Date/Time. Click on Refresh. See that

Default is selected at the bottom.

10) Now rerun your application , you should be able to see an enrty for your app in the log viewer.

11) Double click on the entry or select the entry and click on view log to view the log details.

12) This is sample log for a successful binding.

*** Assembly Binder Log Entry (11/17/2004 @ 6:37:35 AM) ***

The operation was successful.

Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:

C:\WINNT\Microsoft.NET\Framework\v1.0.3705\fusion.dll

Running under executable

F:\Net\BindingConsoleClient\bin\Debug\BindingConsoleClient.exe

--- A detailed error log follows.

=== Pre-bind state information ===

LOG: DisplayName = mscorlib, Version=1.0.3300.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089

(Fully-specified)

LOG: Appbase = C:\WINNT\Microsoft.NET\Framework\v1.0.3705\

LOG: Initial PrivatePath = NULL

LOG: Dynamic Base = NULL

LOG: Cache Base = NULL

LOG: AppName = NULL

Calling assembly : (Unknown).

===

LOG: Not processing DEVPATH because this is a pre-jit assembly bind.

LOG: Policy not being applied to reference at this time (private,

custom, partial, or location-based assembly bind).

LOG: Post-policy reference: mscorlib, Version=1.0.3300.0,

Culture=neutral, PublicKeyToken=b77a5c561934e089

LOG: Found assembly by looking in the cache.

13) Now to log failure check the Log Failure check box.

14) Now you can just rename the dll to BindingDLL_old.dll and RUN THE CONSOLE CLIENT APPLICATION. DO NOT BUILD THE

SOLUTION.

15) The binding should fail since the file is not present.

16) The log viewer should an entry for the failure as follows

 

*** Assembly Binder Log Entry (11/17/2004 @ 6:40:45 AM) ***

The operation failed.

Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:

C:\WINNT\Microsoft.NET\Framework\v1.0.3705\fusion.dll

Running under executable

F:\Net\BindingConsoleClient\bin\Debug\BindingConsoleClient.exe

--- A detailed error log follows.

=== Pre-bind state information ===

LOG: DisplayName = BindingDLL, Version=1.0.1782.11785,

Culture=neutral, PublicKeyToken=null

(Fully-specified)

LOG: Appbase = F:\Net\BindingConsoleClient\bin\Debug\

LOG: Initial PrivatePath = NULL

LOG: Dynamic Base = NULL

LOG: Cache Base = NULL

LOG: AppName = NULL

Calling assembly : BindingConsoleClient, Version=1.0.1782.11845,

Culture=neutral, PublicKeyToken=null.

===

LOG: Processing DEVPATH.

LOG: DEVPATH is not set. Falling through to regular bind.

LOG: Attempting application configuration file download.

LOG: Download of application configuration file was attempted from

file:///F:/Net/BindingConsoleClient/bin/Debug/BindingConsoleClient.execonfig.

LOG: Application configuration file does not exist.

LOG: Policy not being applied to reference at this time (private,

custom, partial, or location-based assembly bind).

LOG: Post-policy reference: BindingDLL, Version=1.0.1782.11785,

Culture=neutral, PublicKeyToken=null

LOG: Attempting download of new URL

file:///F:/Net/BindingConsoleClient/bin/Debug/BindingDLL.DLL.

LOG: Attempting download of new URL

file:///F:/Net/BindingConsoleClient/bin/Debug/BindingDLL/BindingDLL.DLL.

LOG: Attempting download of new URL

file:///F:/Net/BindingConsoleClient/bin/Debug/BindingDLL.EXE.

LOG: Attempting download of new URL

file:///F:/Net/BindingConsoleClient/bin/Debug/BindingDLL/BindingDLL.EXE.

LOG: All probing URLs attempted and failed.

17) The last option at the bottom is Custom. To activate this option you need to add a STRING key in the registry named LogPath.Set the value of this to any empty directory. The logs will be created in this folder. Please make sure that the your delete the logs regularly if you using the custom option.

==> HKLM\Software\Microsoft\Fusion\LogPath

18) Close the viewer in case it is running. Rerun the viwer from VS.Net command prompt. Select the Custom option and click refresh.Again run the Console Application this time the entries will be displayed for the Custom option . Click on refresh incase you are unable to view the log entries.

19) To use the middle option ASP.NET. This option misbehaves at times. But I have found a work around for that. Since we have now set a path to log all our errors in a custom specified folder (The folder specified in the logpath) all the errors including ASP.NET will be logged in that folder.

20) Add a button in the web form and call the Add function from the web client.

private void Button1_Click(object sender, System.EventArgs e)

{

BindingDLL.classBind bindingObj = new BindingDLL.classBind();

Response.Write(bindingObj.Add(1,2));

}

21) Now execute the WEB application and Click on the Refresh button on the Viewer. CHECK THAT THE CUSTOM OPTION IS SELECTED AT THE BOTTOM.

22) You will see a couple of entries for aspnet_wp and some unique number say "98e17ea7" which represents your web application.

23) Double click on the your application entries to view the log. Since we have checked the log failure option if there is a binding failure with our Web App it will be logged.

24) Again rename the BindingDLL to BindingDLL_old.dll and rerun the application. You will a similar error

 

*** Assembly Binder Log Entry (11/17/2004 @ 11:24:57 AM) ***

The operation failed.

Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from:

C:\WINNT\Microsoft.NET\Framework\v1.1.4322\fusion.dll

Running under executable

C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe

--- A detailed error log follows.

=== Pre-bind state information ===

LOG: DisplayName = BindingDLL_old

(Partial)

LOG: Appbase = file:///c:/inetpub/wwwroot/WebBindingClient

LOG: Initial PrivatePath = bin

LOG: Dynamic Base =

C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET

Files\webbindingclient\d7b2a0d4

LOG: Cache Base = C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary

ASP.NET Files\webbindingclient\d7b2a0d4

LOG: AppName = 98e17ea7

Calling assembly : (Unknown).

===

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: BindingDLL_old

LOG: Attempting download of new URL

file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET

Files/webbindingclient/d7b2a0d4/98e17ea7/BindingDLL_old.DLL.

LOG: Attempting download of new URL

file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET

Files/webbindingclient/d7b2a0d4/98e17ea7/BindingDLL_old/BindingDLL_oldDLL.

LOG: Attempting download of new URL

file:///c:/inetpub/wwwroot/WebBindingClient/bin/BindingDLL_old.DLL.

LOG: Assembly download was successful. Attempting setup of file:

c:\inetpub\wwwroot\WebBindingClient\bin\BindingDLL_old.DLL

LOG: Entering download cache setup phase.

WRN: Comparing the assembly name resulted in the mismatch: NAME

ERR: The assembly reference did not match the assembly definition found.

ERR: Setup failed with hr = 0x80131040.

ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

25) To log failures for satellite assemblies create a DWORD key called LogResourceBinds and set its value to more than 0.

==> HKLM\Software\Microsoft\Fusion\LogResourceBinds

 

-- Please post your queries and comments for my articles in the usergroup for the benefit of all. I hope this step from my end is helpful to all of us.

Regards,

Namratha (Nasha)

 


View other groups in this category.

Click here
Also on MSN:
Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily Horoscopes

To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.

Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.

If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.

Reply via email to