Licence registration not working during unit testing.

When running unit tests using XUnit I register my licence key without error. When I generate a PDF the output document remains watermarked as using a trial licence.

How can I unit test without the watermark in the document?



2 Replies

KR Kalaiyarasu Rasu Syncfusion Team June 13, 2024 08:54 AM UTC

Hi Christopher,

Syncfusion license keys are major version and platform specific. The generated license key is just a string that needs to be registered before any Syncfusion control is initiated. Please ensure that you have registered the license key in the entry point of your application.


If you are upgrading from one major version to another, such as from v24.* to v25.*, you should generate and register the corresponding version and product license key in your projects to prevent trial license warnings.


Please, ensure that all the referenced Syncfusion assemblies\NuGet packages(v23.*.*) are all on the same version as license key’s version(v23.*.*) in your project location.

Refer to the following documentation link to get the corresponding version Syncfusion license key.

https://help.syncfusion.com/common/essential-studio/licensing/how-to-generate

Refer to this link for registering the license key,

https://help.syncfusion.com/common/essential-studio/licensing/how-to-register-in-an-application

Image_7663_1718268865710


Find below the knowledge base article to know about which version license key should use in application,

https://www.syncfusion.com/kb/8951/which-version-syncfusion-license-key-should-i-use-in-my-application

ometimes, old Syncfusion packages might be referred from NuGet cache in the project.

So, could you please try cleaning your project, clear the NuGet cache from both “%userprofile%” folder and the NuGet installed location, deleting the bin\obj folders and rebuild your application, then check whether it resolves the issue?

If the reported issue is still not resolved,  please share us the following details to check issue further from our side, 

  1. List of Syncfusion NuGet packages\assemblies used and its version,
  1. Registered license key in your application,
  2. Target Framework and Platform of your application, 
  3. Screenshot of license key registered place.
  4. Share the sample project if possible

Please let us know any concerns.


Regards,
Kalaiyarasu R



RJ Robel Jason June 17, 2025 10:33 AM UTC

License registration may fail during unit testing if the test environment lacks the necessary configuration or access credentials. Often, the license check relies on runtime conditions or external resources that aren't properly mocked in the test context. If the licensing mechanism depends on a hardware ID, file system, or network, these might not be available in isolated test runs. To avoid such issues, it's common to mock or bypass license validation during unit testing. Ensuring your license check is decoupled from core logic helps maintain test reliability and performance. (See More)


Loader.
Up arrow icon