I've tried with the following test but I always get "The included Syncfusion license is invalid. Please refer to this help topic(https://help.syncfusion.com/aspnet-core/licensing/licensing-errors#invalid-key) for more information." message and the validation fails.
[Fact]
public void Syncfusion_license_should_be_valid()
{
SyncfusionLicenseProvider.RegisterLicense("my-community-license");
var validateLicense = SyncfusionLicenseProvider.ValidateLicense(Platform.ASPNETCore, out var message);
message.Should().BeNull();
validateLicense.Should().BeTrue();
}
I have done this exact same test with Syncfusion.EJ2.AspNet.Core version 19.4.0.56 and a newly generated license key for that version, the results were green.
But as soon as I upgrade to 20.1.0.47 and generate a new license, the test fails with "The included Syncfusion license is invalid."
Hi Lukkian,
We cross-checked the shared information and validated the v20.1.0.47 ASP.NET Core license keys with v20.1.0.47 Syncfusion.Licensing.dll. We have got it true for the ASPNETCore platform in the ValidateLicense() method.
We suspect that still old Syncfusion.Licensing assembly might be referred in the application. Could you please clean your project, NuGet cache, delete the bin/obj folders and remove the older assemblies from GAC, and rebuild your application to see if that resolves the issue?
Referring the old Syncfusion.Licensing assembly (v19.4.0.*) and using the latest license keys (v20.1.0.*) will result in invalid key only. Refer the below image.
To know about registering license key,
https://ej2.syncfusion.com/aspnetcore/documentation/licensing/license-key-registration
Also, you should set “CopyLocal” as True to
Syncfusion.Licensing.dll along with all other Syncfusion assemblies and ensure
that the latest Syncfusion.Licensing.dll assembly also present
in the application deployed folders.
Please follow the below knowledge base article to resolve the license warning message.
If the reported issue is still not resolved, please share us the
following details to check issue from our side,
Regards,
Jeyaseelan M
Thanks for the support, I've tried everything but it still doesn't work.
I cleaned the project, NuGet cache, deleted the bin/obj folders and removed the older assemblies from GAC, and rebuild... still doesn't work.
I suspect there must be something wrong with the license generation on my account.
1 - List of Syncfusion NuGet packages\assemblies used and its version.
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="20.1.0.47" />
<PackageReference Include="Syncfusion.Licensing" Version="20.1.0.47" />
2 - License key registered.
Are you sure I should share my license here?
3 - TargetFrameWork and Platform of your application.
TargetFramework: net6.0, AspNet Core (console application on attached sample.)
4 - Screenshot of the issue and license key registered place.
Hi Lukkian,
Sorry for the inconvenience.
We are having a problem with the region date and time format while validating the license. This issue has been resolved now, and it will be included in tomorrow's (April 12, 2022) weekly release.
Could you please change the date’s regional format to English (United States) and confirm the application is working properly without any license errors?
We will notify you soon the latest Syncfusion.Licensing is available in the nuget.org
with the fix.
Please let us know if any concerns.
Regards,
Jeyaseelan M
Hi Lukkian,
Thanks for your patience.
We have published the latest Syncfusion licensing NuGet packages v20.1.0.48 into nuget.org with the fix
Please update the Syncfusion.licensing and all the referred Syncfusion NuGet packages to the latest v20.1.0.48 and confirm us that the problem has been resolved or not.
Let us know if you face any issue.
Regards,
Jeyaseelan M
Yes, everything is working as expected now. Thank you very much.
In .NET core, the conversion utilities for, for example Syncfusion.DocIO are missing a SyncfusionLicenseProvider.Validate method? it would be nice to know if the license that you are using is valid.
I made a small workaround to test if a license is valid, but I would prefer using a method that is simply returning a boolean. Am I missing something?? Code below works, but I guess it's MUCH overkill...
Happy cheers,
Lennart
using TestProject.Shared.Tests;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Xunit;
namespace TestProject.Integration.Tests;
public class SyncfusionLicenceTest
{
[Fact]
public void SyncFusionCreateDocumentShouldNotContainLicenceWarning()
{
// Arrange
TestsHostFixture.BuildHost(); // build an application Host in your way here
var testText = "This should be the only text in the generated licenced document";
// Act
// create document with text
using var document = new WordDocument();
document.AddSection().AddParagraph().AppendText(testText);
// save this word document as text
using var memoryStream = new MemoryStream();
document.Save(memoryStream, FormatType.Txt);
// read it's contents into string
using var reader = new StreamReader(memoryStream);
string wordDocumentAsText = reader.ReadToEnd().Trim();
// Assert, check if no licence text is added (only the clear string should be there)
// false, syncfusion licence is invalid
Assert.Equal(wordDocumentAsText, testText);
}
}
Lennart,
You should add the Syncfusion.Licensing
assembly\NuGet package reference to your project to use the
SyncfusionLicenseProvider.Validate() method. Since
Syncfusion.LicenseProvider.Validate() is an internal method, you need to type the method name
manually, as IntelliSense cannot detect it.
|
bool IsResult = SyncfusionLicenseProvider.ValidateLicense(Platform.FileFormats); |
Let us know any concerns.