Thanks for the detailed explanation from the Syncfusion team. One additional point that can help during unit testing is making sure the license registration runs before any PDF-related objects are created, especially since test projects often bypass the usual application entry point. In XUnit, registering the license in a shared test fixture or test class constructor can prevent trial watermarks, and it’s also important to confirm that the test project uses the same Syncfusion package versions as the main application, as version mismatches commonly cause licensing issues in isolated test environments.
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?
SIGN IN To post a reply.
11 Replies
1 reply marked as answer
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
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,
- List of Syncfusion NuGet packages\assemblies used and its version,
- Registered license key in your application,
- Target Framework and Platform of your application,
- Screenshot of license key registered place.
- Share the sample project if possible
Please let us know any concerns.
Regards,
Kalaiyarasu R
Marked as answer
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)
PJ
Piltos Jurdel
January 6, 2026 06:49 AM UTC
PD
Piltor Devor
January 12, 2026 04:03 PM UTC
This is a helpful explanation. In addition to checking the Syncfusion license version and package consistency, it’s also important during unit testing to ensure the license registration runs before any PDF-related code is executed, even in test initialization methods. Sometimes missing setup logic in test projects can cause trial watermarks.
I’ve faced similar issues before, and detailed troubleshooting guides like this one can also help developers identify environment-related problems
EJ
Elbon Jonel
January 22, 2026 09:03 AM UTC
Thank you for the detailed explanation from the Syncfusion team. One additional tip that could be helpful during unit testing is ensuring that the license registration happens before any PDF-related objects are created. This is especially important since test projects often skip the usual application entry point. In XUnit, registering the license in a shared test fixture or constructor can help avoid trial watermarks. Additionally, it's crucial to verify that the test project is using the same Syncfusion package versions as the main application, as version mismatches are a common cause of licensing issues in isolated test environments.
EJ
Elbon Jonel
January 23, 2026 09:52 AM UTC
This is a clear and detailed explanation about Syncfusion licensing. It thoroughly covers version compatibility, registration steps, and troubleshooting tips, making it very helpful for developers to avoid trial license issues and ensure smooth project builds.
NJ
Norita Javin
January 29, 2026 02:02 PM UTC
Unit tests often run in isolated contexts, which is why PDF licenses need to be registered before any document generation code runs.
In a similar way, when designing interior layouts, planning early ensures everything fits perfectly—just like ensuring correct shaker cabinets matching interior from the start.
This usually happens when the license is not being initialized in the test project before the PDF library is called. Make sure the license key is loaded at the very start of the unit test setup (for example in a global test initializer or constructor) and that the test environment has access to the same configuration or license file path as the main application. Rebuilding the solution and verifying dependency loading can also help. Proper setup and structured configuration just like organizing modules efficiently similar to rta cabinets nationwide shipping ensures everything runs smoothly without unexpected trial watermarks.
PJ
Piltos Jurdel
February 24, 2026 10:04 AM UTC
If the PDF still shows a watermark during unit testing, it means the license is not being activated correctly in the test execution flow. Verify that the license registration code runs before PDF generation and that it is not reset between test setups. You can also create a separate test configuration with a valid development license or mock the licensing validation so the watermark is disabled during automated tests.
PJ
Piltos Jurdel
February 24, 2026 10:06 AM UTC
This issue usually happens because the license is not properly initialized in the test environment or the test framework is using a trial context instead of the registered license. Make sure the license key is loaded before generating the PDF and that it is applied to the same application context used during document creation. In unit tests, you may need to mock the license service or configure it explicitly for the test runtime. Another option is to use a test license provided by the vendor instead of relying on the trial mode.
MG
Mugesh Ganapathy
Syncfusion Team
February 26, 2026 02:31 PM UTC
Hi Piltos,
The below article explains the steps to resolve the issue for projects using Syncfusion components via NuGet or Essential Studio installer. Please refer to the KB for more details.
Please let us know if you need any further assistance.
Regards,
Mugesh G.
SIGN IN To post a reply.
- 11 Replies
- 8 Participants
- Marked answer
-
CH Christopher
- Jun 11, 2024 06:50 AM UTC
- Feb 26, 2026 02:31 PM UTC