Assembly: System (in system.dll)
'Declaration <SerializableAttribute> _ Public Class LicenseException Inherits SystemException 'Usage Dim instance As LicenseException
/** @attribute SerializableAttribute() */ public class LicenseException extends SystemException
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 HostProtectionAttribute attribute applied to this class has the following Resources property value: SharedState. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
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
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 EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.