ArcGIS SDK  

Add-Ins

ESRI Line Number Generator

The Error Handler add-in can display line number information if there is any line number data available within the source file. Visual Basic supports the extraction of line number information, but only when lines are explicitly labeled with line numbers. This add-in adds line numbers to the appropriate lines within the source files of the active project. Line numbers are added only to those lines that support labeling.

To access the add-in, click the Add-Ins menu and click ESRI Line Number Generator. The add-in displays the dialog box below, which lets you select to which files within a project line numbers should be added. You can bypass the dialog box by pressing the Shift and Ctrl keys when you click ESRI Line Number Generator in Add-ins menu. To update the line number information after edits have been made, reexecute the add-in.

Line Number Generator dialog box

Line number labels in the source code can be obtrusive, making the code difficult to read, hence you should only add them to debug code when tracing down a problem; remove them after the problem is found. A sample of these labels placed in the source code is shown below.

Dim pSourceFeature As IFeature
Dim pTargetFeature As IFeature
Dim i As Long
53: Set pSourceFeature = pFeatureCursor.NextFeature

55: Do While (Not pSourceFeature Is Nothing)
56: Set pTargetFeature = pTargetClass.CreateFeature

58: Set pTargetFeature.Shape = pSourceFeature.ShapeCop

60: For i = 0 To pTargetClass.Fields.FieldCount - 1
61: If ((pTargetClass.Fields.Field(i).Type <> esriFieldTypeGeometry) And _
(pTargetClass.Fields.Field(i).Type <> esriFieldTypeOID)) Then

63: pTargetFeature.Value(i) = Now End If

65: Next i
66: pTargetFeature.Store

68: Set pSourceFeature = pFeatureCursor.NextFeature
69: Loop

Using a combination of the error handler add-in and this line number generator, it is possible to ship software that will provide rich error information in the event of runtime errors within a released product. Even if the line number labels are not placed in the source code during the majority of the development, it is valid to create the release build with the line numbers in place. In this way, if an end user encounters an error, rich context error information is available to investigate the error.

How to set up the ESRI VB6 add-ins