Xceed .NET Libraries Documentation

In This Topic
    Inner Exception
    In This Topic

    Whenever you contact technical support regarding an exception, please include the exception's type, message, stack trace and all InnerException objects. This information will allow for a quick diagnostis of the issue. Here is sample code that collects the required information:

    C#
    Copy Code
    try
    {
      /* ...Code that triggers an exception... */
    }
    catch( Exception exception )
    {
      // Output some information about the exception
      System.Diagnostics.Debug.WriteLine( "-->{0}: {1}\n{2}", exception.GetType().Name, exception.Message, exception.StackTrace );
    
      // Fetch the inner exception
      exception = exception.InnerException;
    
      // While there is an exception
      while( exception != null )
      {
        // Output some information about it
        System.Diagnostics.Debug.WriteLine( "-->Inner exception: {0}: {1}\n{2}", exception.GetType().Name, exception.Message, exception.StackTrace );
    
        // Fetch the inner exception
        exception = exception.InnerException;
      }
    }
    VB.NET
    Copy Code
    Try
      ' ...Code that triggers an exception...
    Catch exception As Exception
      ' Output some information about the exception
      System.Diagnostics.Debug.WriteLine("-->{0}: {1}" & Constants.vbLf & "{2}", exception.GetType().Name, exception.Message, exception.StackTrace)
    
      ' Fetch the inner exception
      exception = exception.InnerException
    
      ' While there is an exception
      Do While exception IsNot Nothing
            ' Output some information about it
            System.Diagnostics.Debug.WriteLine("-->Inner exception: {0}: {1}" & Constants.vbLf & "{2}", exception.GetType().Name, exception.Message, exception.StackTrace)
    
            ' Fetch the inner exception
            exception = exception.InnerException
      Loop
    
      ' OPTIONAL: Depending on the architecture of the application, it might be a good idea to rethrow the exception
      'Throw
    End Try