# Runtime Licensing Diagnostics

## Environment

| Version    | Product(s)                       | Author                                                                |
| ---------- | -------------------------------- | --------------------------------------------------------------------- |
| 2025.3.806 | Document Processing & Telerik UI | [Yoan Karamanov](https://www.telerik.com/blogs/author/yoan-karamanov) |

## Description

In certain environments an application may still show a trial watermark (or trial sheet) **at runtime** even though everything looks correct at **build time**:

* Valid `telerik-license.txt` file is present.
* Build logs indicate Telerik products detected (class library and executable).
* No licensing build errors are reported.

Yet the rendered UI (document, control, page) contains a watermark.

These issues surface in two categories:

1. **Web products (ASP.NET AJAX, MVC, Core, Blazor)** – Incorrect script load order or duplicate script imports where one import overrides a previously applied license.
2. **.NET applications with extensibility or plugins (WPF, WinForms, class libraries, host wrappers)** – The entry assembly at runtime differs (for example, a host like `SentinelDotNetFx.dll`), which changes the licensing evaluation path.

Runtime diagnostics in `Telerik.Licensing` help correlate what the licensing engine sees (entry assembly, loaded assemblies, product metadata, and license evidences) with the final `IsLicenseValid` result.

## Solution

### 1. Enable Diagnostics Early

Call `Telerik.Licensing.TelerikLicensing.EnableDiagnostics()` **as early as possible**, before any Telerik UI controls or Document Processing code is first reached or loaded.

### 2. Plugin or Non-Standard Entry Scenarios

If the code runs as a plugin or a dynamically loaded context (no traditional entry assembly, or an unexpected wrapper assembly), call `TelerikLicensing.Register()` **after** enabling diagnostics to provision runtime script keys.

### 3. Execute

Trigger the Telerik code so the licensing pipeline executes.

### 4. Collect the Log

Read the accumulated diagnostics text from `Telerik.Licensing.TelerikLicensing.Diagnostics` and persist it (file, console). The log grows for the life of the process. Restart the process to clear it.

### 5. Analyze Key Sections

Look for:

* Entry assembly (`Assembly.GetEntryAssembly()`)
* Product metadata extraction (`ProductMetadataForAssembly ...`)
* License evidences (subscription or perpetual tokens)
* Final resolution line (`Resolved: IsLicenseValid: ...`)

### 6. Disable When Done

Diagnostics add overhead and must not remain enabled in production indefinitely.

### Performance and Operational Notes

* Diagnostics add measurable overhead. Use them only during investigation.
* Log size grows monotonically until you restart the process.
* Capture the log after reproducing the watermark, then disable diagnostics.

## See Also

* [License Activation Errors and Warnings](https://www.telerik.com/document-processing-libraries/documentation/distribution-and-licensing/license-key/activation-errors-and-warnings)
* [Adding the License Key to CI Services](https://www.telerik.com/document-processing-libraries/documentation/distribution-and-licensing/license-key/adding-license-key-ci-cd-services)
* [License Key FAQ](https://www.telerik.com/document-processing-libraries/documentation/distribution-and-licensing/license-key/frequently-asked-questions)
* [License Agreement](https://www.telerik.com/document-processing-libraries/documentation/distribution-and-licensing/license-agreement)
* [Redistributing Telerik Document Processing](https://www.telerik.com/document-processing-libraries/documentation/distribution-and-licensing/redistributing-telerik-document-processing)
* [Unable to find package Telerik.Licensing](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/dpl-package-update-failure-license)
* [Handling License Key File Name and Environment Variable Name Changes in the 2025 Q1 Release](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/handling-license-file-name-changes)
* [Telerik.Licensing NuGet package is not available on the Telerik NuGet feed](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/dpl-telerik-licensing-nuget-feed)
* [Diagnostic Options for Telerik Licensing](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/telerik-trial-version-message)
* [Resolving License Validation Issues in Telerik Document Processing Libraries](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/license-not-recognized-telerik-document-processing-libraries)
* [Telerik License Approaches](https://github.com/LanceMcCarthy/DevOpsExamples?tab=readme-ov-file#telerik-license-approaches)
