Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
386
|
Chapter 7: Exception Handling
catch (Exception e) // Note that you would use one catch block or the other,
{ // not both.
// This displays the exception information along
// with any fusion log information.
Console.WriteLine(e.ToString( ));
}
}
Discussion
Use this technique to debug problems when loading an assembly from a file. When
using the ToString method of the Exception object, notice the bottom part of the
error message that starts with “Fusion log follows.” This is the section that can pro-
vide some clue as to why the reflection APIs could not find your assembly. If you
want just the fusion information, you can use the
FusionLog property of one of the
aforementioned exception objects. The Assembly Binding Log Viewer (fuslogvw.exe)
is another place where the load failure information can be retrieved. In order for this
log to be filled, the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Fusion|ForceLog and LogFailures entries should be specified as type
DWORD with a
value of 1 for each entry. Without these entries, the log will not record failure infor-
mation, and it will only be available from the
FusionLog property.
See Also
See the “BadImageFormatException Class,” “FileLoadException Class,” and “File-
NotFoundException Class” topics in the MSDN documentation.
7.8 Mapping Back and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Joe Mayo
C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata