# Troubleshoot License Problems

In rare scenarios, clients keep getting Licensing watermarks in some environments, while when building the project, everything has been verified to work correctly:

* There is a proper `telerik-license.txt` file.
* Build logs show our product has been detected.
* At runtime, the Report Viewers still show a Licensing watermark.

## Telerik Licensing Diagnostics

### Build Diagnostics

Use the `TelerikLicensingVerbosity` configuration in your project file to enable detailed licensing diagnostics during build. A sample configuration of the proj file is shown below:

```XML
<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<OutputType>Exe</OutputType>
		<TargetFramework>net9.0</TargetFramework>
		<RootNamespace>MyProjNamespace</RootNamespace>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>enable</Nullable>
		<TelerikLicensingVerbosity>diagnostic</TelerikLicensingVerbosity>
	</PropertyGroup>
	<ItemGroup>
		<PackageReference Include="Telerik.Reporting"
		                  Version="20.3.26.1110"/>
	</ItemGroup>
</Project>
```

Here are the possible values for `TelerikLicensingVerbosity`:

* `quiet` / `q` - the lowest verbosity level;
* `verbose` / `v` - the normal/middle verbosity level;
* `diagnostics` / `diagnostic` / `diag` / `d` - the highest verbosity level;

The default value, when not explicitly set, generates logs with verbosity between 'quiet' and 'verbose'.

### Runtime Diagnostics

Starting with **Telerik.Licensing** version 1.6.24, we provide a utility that does runtime diagnostics.

1. Install `Telerik.Licensing` library **1.6.24** or later from the [NuGet.org Telerik.Licensing package page](https://www.nuget.org/packages/Telerik.Licensing). We recommend the latest version of the package.

   > If your project targets the `.NET Framework`, you may need to add a binding redirect to your configuration file. If you use a newer version, change the code accordingly:

   ```XML
   <dependentAssembly>
       <assemblyIdentity name="Telerik.Licensing.Runtime" publicKeyToken="98bb5b04e55c09ef" culture="neutral"/>
       <bindingRedirect oldVersion="0.0.0.0-1.6.31.0" newVersion="1.6.31.0"/>
   </dependentAssembly>
   ```

2. To enable the runtime diagnostics, please call the method `Telerik.Licensing.TelerikLicensing.EnableDiagnostics()` as early as possible before loading your Telerik Report Viewers:

   For example, you may add the code in the *startup file* of the project. In ASP.NET projects, you may use the `Application_Start` event handler in the `Global.asax` file.

   Here is a sample code:

   ```C#
   protected void Application_Start(object sender, EventArgs e)
   {
       string logPath = Server.MapPath("~/TelerikLicensing.log");
       var writer = File.AppendText(logPath);
       writer.AutoFlush = true;
       Console.SetOut(writer);
       Telerik.Licensing.TelerikLicensing.EnableDiagnostics();
   }
   ```

   The above code will add the Licensing validation logs to the file 'TelerikLicensing.log' in your application's main folder.

3. (*optional*) If you make a call to the method `TelerikLicensing.Register()`, do this after enabling diagnostics with the above code line.

4. Set up the Reporting Engine, then collect the content of the aggregated licensing log in `Telerik.Licensing.TelerikLicensing.Diagnostics`:

   ```C#
   Console.WriteLine(Telerik.Licensing.TelerikLicensing.Diagnostics);
   ```

   For example, if you use a Report Viewer with [REST Service in .NET with Minimal API](https://www.telerik.com/products/reporting/documentation/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-6-with-minimal-api), you can collect the log after creating the [Reporting REST Service](https://www.telerik.com/products/reporting/documentation/embedding-reports/host-the-report-engine-remotely/overview) in the *Program.cs* file:

   ```C#
   // ...
   // Enable the runtime Telerik Licensing diagnostics
   string logPath = "TelerikLicensing.log";
   var writer = File.AppendText(logPath);
   writer.AutoFlush = true;
   Console.SetOut(writer);
   Telerik.Licensing.TelerikLicensing.EnableDiagnostics();
   // ...
   // Configure the Telerik Reporting REST Service with Minimal API
   builder.Services.AddRazorPages()
                   .AddTelerikReporting("ReportingNet", reportsPath);

   // Collect the content of the aggregated Telerik Licensing log
   Console.WriteLine(Telerik.Licensing.TelerikLicensing.Diagnostics);
   // ...
   ```

5. Read the Licensing validation logs in the file 'TelerikLicensing.log' in your application's main folder.

## See Also

* [License Activation Errors and Warnings](https://www.telerik.com/products/reporting/documentation/licensing/license-errors-and-warnings)
* [Setting Up Your License Key](https://www.telerik.com/products/reporting/documentation/licensing/setting-up-your-telerik-reporting-license-key)
* [Frequently Asked Questions about Your Telerik Reporting License Key](https://www.telerik.com/products/reporting/documentation/licensing/license-faq)
* [Adding the License Key to CI Services](https://www.telerik.com/products/reporting/documentation/licensing/add-license-key-ci-services)
* [License Agreement](https://www.telerik.com/purchase/license-agreement/reporting-dlw-s)
