Exception Hunter - 3.0

Exception Hunter

Learning Exception Hunter - 3.0

Examples using the command line

This topic provides some simple examples of how to use the command line interface.

Analyzing an assembly for exceptions

To detect the exceptions for all methods in the assembly WidgetAssembly.dll :

hunt /assembly:WidgetAssembly.dll 
     /all

If you do not specify the path to the assembly file, Exception Hunter assumes it is in the same folder as the Hunt.exe file. To specify an assembly in a different folder, enclose the full path in quotes:

hunt /assembly:"C:\MyProjects\WidgetProject\WidgetAssembly.dll" 
     /all

Note: If you do not specify either /all or at least one method using the /method argument, an error is returned.

Analyzing more than one assembly

To analyze more than one assembly, use separate /assembly arguments to specify each assembly:

hunt /assembly:"C:\MyProjects\WidgetProject\WidgetAssembly1.dll"
     /assembly:"C:\MyProjects\WidgetProject\WidgetAssembly2.dll"
     /assembly:"C:\MyProjects\WidgetProject\WidgetAssembly3.dll"
     /all

Selecting specific methods to analyze

To specify particular methods to analyze, use the /method argument. Use a separate argument for each method:

hunt /assembly:"C:\MyProjects\WidgetProject\WidgetAssembly1.dll"
     /method:System.Int32.ToString(String)
     /method:System.Code.WidgetFunction()

You need to specify only enough of the name to make it unique.

Producing a report

By default the results of the analysis are output to the console.

Use the /xml switch to produce a results file containing the results as a set of xml data that you can translate into whatever format you require. You can also choose one of two HTML format reports:

  • /methodReport

    The results are organized by method.

  • /exceptionReport

    The results are organized by exception type.

Setting analysis options

Use the following switches to control how Exception Hunter analyzes your methods:

/frameworkVersionx.x

Analyzes assemblies against a specified version of the .NET Framework. For example, /frameworkVersion1.1, frameworkVersion3.0.

If a framework switch is not specified, .NET framework 2.0 is assumed.

/noGAC

Does not search the GAC when analyzing assemblies.

/stackDepth: n

Sets the maximum depth of the stack that is used when displaying exceptions. Note that a value of 5 or greater may result in Exception Hunter taking a long time to complete its operation.

/maxOverrides: n

Specifies the maximum number of virtual or interface overrides to follow. If the number of possible implementations of an object is greater than the number specified in this argument, Exception Hunter will ignore all exceptions thrown by this method.

Some methods like GetHashCode() and interfaces like IComparer can be implemented by very many objects, so increasing the value of this option can results in much longer processing times.

/ignoreCodeBranches

When this argument is specified, Exception Hunter does not attempt to eliminate code branches based on the possible values that have been evaluated for a variable.

/fastMode

Uses a faster algorithm to analyze the code. Produces results more quickly but detects fewer exceptions. Typically, Exception Hunter detects fewer potential NullReferenceException and InvalidCastException exceptions but more exceptions that may never be thrown due to code logic, for example ArgumentNullException.

/ignoreChattyClasses

Ignores calls to the ResourceManager and other apparently simple .NET library methods that call into many other parts of the library; using this switch can reduce the 'noise' of unexpected results and reduces the time required to complete the analysis.

For a complete list of arguments and syntax for the command line, type:

hunt /? /v

See also

Analyzing Your Code

Using the command line

Was this article helpful?

Search support
Forums