LicenseException
Class
Definition
Represents the exception thrown when a component cannot be granted a license.
public class LicenseException : SystemException
- Inheritance
Inherited Members
System.Exception
System.Object
Examples
The following code example shows how to catch a LicenseException and interpret its content. In the sample, the application calls the Validate method for a Form that is not licensed. Upon catching the exception, the sample fetches the respective error message, the type of component that was not granted a license, the stack trace, and the origin of the exception.
This example requires that you have specified the LicenseProvider by marking the Form with a LicenseProviderAttribute attribute. For more information on how to do this, see the LicenseManager class.
try
{
License^ licTest = nullptr;
licTest = LicenseManager::Validate( Form1::typeid, this );
}
catch ( LicenseException^ licE )
{
Console::WriteLine( licE->Message );
Console::WriteLine( licE->LicensedType );
Console::WriteLine( licE->StackTrace );
Console::WriteLine( licE->Source );
}
try {
License licTest = null;
licTest = LicenseManager.Validate(typeof(Form1), this);
}
catch(LicenseException licE) {
Console.WriteLine(licE.Message);
Console.WriteLine(licE.LicensedType);
Console.WriteLine(licE.StackTrace);
Console.WriteLine(licE.Source);
}
Try
Dim licTest As License
licTest = LicenseManager.Validate(GetType(Form1), Me)
Catch licE As LicenseException
Console.WriteLine(licE.Message)
Console.WriteLine(licE.LicensedType)
Console.WriteLine(licE.StackTrace)
Console.WriteLine(licE.Source)
End Try
Remarks
The LicenseManager.Validate method throws LicenseException when a component cannot obtain a valid license. This occurs when a component is either not licensed, or is licensed but cannot be granted a valid license.
For more information on licensing, see How to: License Components and Controls.
Constructors
| LicenseException(Type) |
Initializes a new instance of the LicenseException class for the type of component that was denied a license. |
| LicenseException(SerializationInfo, StreamingContext) |
Initializes a new instance of the LicenseException class with the given SerializationInfo and StreamingContext. |
| LicenseException(Type, Object) |
Initializes a new instance of the LicenseException class for the type and the instance of the component that was denied a license. |
| LicenseException(Type, Object, String) |
Initializes a new instance of the LicenseException class for the type and the instance of the component that was denied a license, along with a message to display. |
| LicenseException(Type, Object, String, Exception) |
Initializes a new instance of the LicenseException class for the type and the instance of the component that was denied a license, along with a message to display and the original exception thrown. |
Properties
| LicensedType |
Gets the type of the component that was not granted a license. |
Methods
| GetObjectData(SerializationInfo, StreamingContext) |
Sets the SerializationInfo with information about the exception. |