MSDN Archive Home
Help and FAQs
Exception Filter Inject - Provides C# dll/exe's with execption filter support.
All Resource Updates
Change History (all pages)
Resource Page Description
ExceptionFilterInject is a tool which modifies the IL in a managed-only dll to provide exception filter support for languages (such as C#) which do not have exception filter support.
Exception filters provide the ability to run arbitrary code during the 'handler search' phase of exception processing. This is especially useful to allow you to (1) catch all non-critical exceptions in your top-level exception filter without needing to also catch exceptions that should be reported as bugs (such as NullReferenceException) -and- (2) allow you to save a minidump of the exception or report the exception to Watson.
This project also contains a sample which uses exception filters in managed code to control which exceptions are caught and to save a minidump.
How to use this tool:
1. In any place where you would like to add an exception filter, simply add a try/catch, and catch System.Execption (in other words, create a try/catch which catches all exceptions).
2. Define a static public or internal function which returns a 'bool' and takes the Exception as an argument (ex: static bool MyFunction(Exception exception)). The bool indicates if the exception filter should be caught.
3. Build your assembly
4. Run your assembly though this tool
: ExceptionFilterInject.exe <input
filter_function uses the IL Assembly syntax for function names (ex: MyNamespace.MyClass::MyFunction).
: ExceptionFilterInject.exe c:\myproj\myassembly.dll MyNamespace.MyClass::MyFunction c:\myproj\bin %tmp%
Apr 21 2008 at 9:26 PM
, version 3
Sign in to add a comment
Mon Apr 21 2008 at 7:00 AM
More Tags ...
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.