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?
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
Find below the knowledge base article to know about which version license key
should use in 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,
Please let us know any concerns.
Regards,
Kalaiyarasu R
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)