DeployLX Software Protection System

Handling Errors During Validation

License validation is a complex process subject to many opportunities for failure. Providing consistent error handling and reporting is essential to managing the user experience.

Exceptions and Validation Records

When a validation failure occurs DeployLX collects information into a ValidationRecord collection. The collection may be processed by the protected software to determine why a license has failed.

If there are no valid licenses available DeployLX will throws a NoLicenseException. Check the ValidationRecords collected during validation to determine why validation failed.

Use the GetSummaryErrorMessage to determine the most specific cause of the failure from the list of all validation records.

If you catch the NoLicenseException you are responsible for preventing the user from continuing to use the protected object by either throwing your own exception, shutting down the application, or reducing functionality.

Errors During Validation

Some failures are immediately reported to the user giving them a chance to fix the problem before failing completely. For example during online activation the user is notified if the server cannot be reached and is given the option to retry.

By default the error is displayed to the user using a message box or the error report form. To display your own messages or forms during validation then handle the ErrorOccured event of the SecureLicenseManager.

Handling the ErrorOccurred event only applies to errors that are reported immediately to the user. All others must be handled by processing the NoLicenseException thrown when no valid license can be found.

AddHandler SecureLicenseManager.ErrorOccurred, AddressOf Me.LicenseErrorOccurred
_license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
...    
Private Sub LicenseErrorOccurred(ByVal sender As Object, ByVal e As LicenseEventArgs)
    MesssageBox.Show(e.ValidationRecord.ToString)
End Sub
SecureLicenseManager.ErrorOccurred += new LicenseEventHandler( LicenseErrorOccurred );
_license = SecureLicenseManager.Validate( this, null, null );
...
private void LicenseErrorOccurred( object sender, LicenseEventArgs e )
{
    MesssageBox.Show( e.ValidationRecord.ToString() );
}

Errors During Asynchronous Validation

Errors that occur during asynchronous validation are handled by the DelayedValidationFailed event. Take any appropriate action in the event handler such as shutting down the application or displaying a message to the user and disabling advanced features.

AddHandler SecureLicenseManager.DelayedValidationFailed, AddressOf Me.LicenseErrorOccurred
_license = SecureLicenseManager.Validate(Me, Nothing, Nothing)
...
    
Private Sub LicenseErrorOccurred(ByVal sender As Object, ByVal e As LicenseEventArgs)
    MesssageBox.Show("Application already running on the network.")
    Application.Exit
End Sub
SecureLicenseManager.DelayedValidationFailed += new LicenseEventHandler( LicenseErrorOccurred );
_license = SecureLicenseManager.Validate( this, null, null );
...
private void LicenseErrorOccurred( object sender, LicenseEventArgs e )
{
    MesssageBox.Show( "Application already running on the network." );
    Application.Exit();
}
  


		
		
		

Disabling the Automatic Failure Report

DeployLX displays a final error report if validation fails. The report provides contact information for the user to obtain support and details the complete list of validation records.

If you will handle the license exception directly and display the appropriate information to the user you can disable the failure report form that DeployLX displays automatically.

Disabling the form for all validation attempts

Add the LicenseHelpAttribute to the protected assembly and set the ShowFinalErrorReport property to false.

<Assembly: DeployLX.Licensing.v5.LicenseHelp( _
    ShowFinalErrorReport := False)>
[assembly: DeployLX.Licensing.v5.LicenseHelp( 
    ShowFinalErrorReport = false )]

Disabling the form for a single validation request

  1. Create an instance of the LicenseValidationRequestInfo class.
  2. Set the ShowFinalErrorReport property to false.
  3. Pass the LicenseValidationRequestInfo class when calling SecureLicenseManager.Validate.
Dim info As New LicenseValidationRequestInfo()
info.ShowFinalErroReport = False
_license = SecureLicenseManager.Validate(Me, Nothing, info)
LicenseValidationRequestInfo info = new LicenseValidationRequestInfo();
info.ShowFinalErroReport = false;
_license = SecureLicenseManager.Validate( this, null, info );

Getting More Detailed Errors

Error messages do not contain too much information about the internal workings of the validation system. This is to reduce user confusion and is meant to provide enough information for them to either fix the problem themselves or make an effective request for support. During development however detailed messages can be more helpful.

Use Developer Mode to gather additional details.

Error Messages Reference

Each error has a corresponding resource id. The resource id is used to identify the error by name and to load a standard error message from the assembly resources.

See Error Messages, Form Text and Resources for a complete error reference.

See Also