PROBLEM

.NET application stops executing but does not produce an error

Last Published: April 25, 2020

Description

When running an ArcObjects application written in Visual Studio .NET, the code stops executing, but does not return an error.

Cause

Exception handling needs to be added to the application.

Solution or Workaround

The C# and Visual Basic .NET code samples show how to add exception handling to the application.

  1. C# exception handling

    Code:

    try
    {
    //Code that might cause an error
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message);
    }
    finally
    {
    //cleanup code goes here
    }

  2. Visual Basic .NET exception handling

    Code:
    Try
    'Code that might cause an error
    Catch ex As Exception
    MessageBox.Show(ex.Message)
    Finally

    End Try

Article ID:000006253

Software:
  • ArcMap 8 x
  • ArcMap 9 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic