# LicenseException Class

> LicenseException class in the TX Sheet Control .NET API: Offline licensing failure with the same stable code as the JavaScript API; never contains the token.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Inherits:** `System.Exception`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > LicenseException Class
- **585 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/licenseexception/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/licenseexception/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/licenseexception/llms-full.txt

---

Offline licensing failure with the same stable code as the JavaScript API; never contains the token.

### Syntax

```csharp
public class LicenseException
```

Interfaces: `ISerializable`.

### Members

#### Properties

| Property | Description |
|---|---|
| [Code](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/licenseexception/code-property/llms-full.txt) | Stable machine-readable licensing error. |

### Examples

Convert an application-supplied workbook and return a structured failure to the caller. Missing or invalid licenses fail; configure a valid signed token before retrying.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<(byte[]? Pdf, string? Error)> TryConvertInvoiceAsync(byte[] workbookBytes, string signedLicense)
{
    try
    {
        await using var control = new ServerSheetControl(new ServerSheetControlOptions { License = signedLicense });
        await control.LoadAsync(workbookBytes, StreamType.SpreadsheetML);
        return (await control.SaveAsync(StreamType.PDF), null);
    }
    catch (LicenseException error)
    {
        return (null, error.Code + ": " + error.Message);
    }
}
```

### See Also

- [TXTextControl.TXSheetControl.Server Namespace](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## In This Section

- [LicenseException.Code Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/licenseexception/code-property/llms-full.txt): LicenseException.Code property in the TX Sheet Control .NET API: Stable machine-readable licensing error. Covers its type string and a C# example.

---

## Nearby

- **Previous:** [JsonSaveOptions.Pretty Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/jsonsaveoptions/pretty-property/llms-full.txt)
- **Next:** [LicenseException.Code Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/licenseexception/code-property/llms-full.txt)
