LicenseException Class
Assembly: System (in system.dll)
'Declaration <SerializableAttribute> _ Public Class LicenseException Inherits SystemException 'Usage Dim instance As LicenseException
/** @attribute SerializableAttribute() */ public class LicenseException extends SystemException
SerializableAttribute public class LicenseException extends SystemException
Not applicable.
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.
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 System.Windows.Forms.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 System.Windows.Forms.Form with a LicenseProviderAttribute attribute. For more information on how to do this, see the LicenseManager class.
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
try {
License licTest = null;
licTest = LicenseManager.Validate(Form1.class.ToType(), this);
}
catch (LicenseException licE) {
Console.WriteLine(licE.get_Message());
Console.WriteLine(licE.get_LicensedType());
Console.WriteLine(licE.get_StackTrace());
Console.WriteLine(licE.get_Source());
}
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.