We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

SetLicense throw exception

We have license 2020 and 2021 year. But this code throw exception
var li = new Aspose.Pdf.License();
try
{
li.SetLicense(GetAsposeTotalLicStream2021());
}
catch (Exception ex2)
{
string s1 = ex2.ToString();
string s2 = ex2.Message;
sError += s1 + ". " + “\r\n” + s2;
}
Error Aspose.Pdf.License
System.Exception: Exception of type ‘System.Exception’ was thrown.
at #=qLfHdFHpXlKIJJ6WGuOB3qOugQpvAbgugLUvfYTfEC_c=.#=z5UKRhBbiOVmp6KYff36s6bbgSVde(Byte[] #=zPyCRY$rKcydbOwaLitM5Tf6F050v) in Aspose.PDF.dll:token 0x6000143+0x69
at #=qLfHdFHpXlKIJJ6WGuOB3qOugQpvAbgugLUvfYTfEC_c=.#=z0bkzpH8vPrL5xSkbbw7LYL3bTSOT.#=zdv5dTq4mtSTHsMP90_FJ19MrqEJK(#=zr3zJuLVglqd3CdeF2fNLJukwG$Gu #=zi4nI9PYPLlOKg_ylh3lpCrQKoyR3) in Aspose.PDF.dll:token 0x6000147+0x62
at #=qLfHdFHpXlKIJJ6WGuOB3qOugQpvAbgugLUvfYTfEC_c=.#=zjWWxp2LcEkRgLBwr8DiQ5Oo=(String #=zyLfOOWo8vLZgZubjgx2mPjYKX2Gw) in Aspose.PDF.dll:token 0x6000140+0x18f
at #=qLfHdFHpXlKIJJ6WGuOB3qOugQpvAbgugLUvfYTfEC_c=.#=z98vSkdI=(String #=zyLfOOWo8vLZgZubjgx2mPjYKX2Gw) in Aspose.PDF.dll:token 0x600013e+0x0
at #=qZYWE8Kld2eswQ8UXdXhJxEiAaE5pff6ycE4IjeRApOQ=.#=zgSbIOStHsC1VrhBalHtbaPgppiVe.#=zC_hndf0VXvm3oFKfWt6ZDyPY0$_C(String #=zhGnF2xq6mfGhSovQtdrgZkI=) in Aspose.PDF.dll:token 0x600023e+0x0
at #=qZYWE8Kld2eswQ8UXdXhJxEiAaE5pff6ycE4IjeRApOQ=.#=zgSbIOStHsC1VrhBalHtbaPgppiVe.#=zftYGvW3nyotll74bq8ew9_H44qVC() in Aspose.PDF.dll:token 0x600023d+0x20
at #=qZYWE8Kld2eswQ8UXdXhJxEiAaE5pff6ycE4IjeRApOQ=.#=z70ZWqH29_2PdDKhnjSs$VT_qx30O(String #=zFkUjSao=) in Aspose.PDF.dll:token 0x600023a+0x35
at #=qZYWE8Kld2eswQ8UXdXhJxEiAaE5pff6ycE4IjeRApOQ=.#=zIlmmcUuUfghUYIAzfuDKT$UIEBtf(Object #=zDS2hBx02ckQ7l_JKvq87_NgfPE1F, ResolveEventArgs #=zlG_N4VKOdi0mw7pt2GiAQiEsieWM) in Aspose.PDF.dll:token 0x6000239+0x22
at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name) in System.Private.CoreLib.dll:token 0x6003680+0xa6
at System.Runtime.Loader.AssemblyLoadContext.OnResourceResolve(RuntimeAssembly assembly, String resourceName) in System.Private.CoreLib.dll:token 0x600367d+0x0
at System.Reflection.RuntimeAssembly.GetResource(QCallAssembly assembly, String resourceName, UInt32& length) in System.Private.CoreLib.dll:token 0x6004e6c+0x31
at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name) in System.Private.CoreLib.dll:token 0x6004e6e+0x24
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zfQcQfzCbVo9Kz6uVkySBHdG4FtLEPU2_Lql__hm3ENMt(Object #=z98vSkdI=) in Aspose.PDF.dll:token 0x600050b+0x0
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zscApEJl3QBvp79g$zluI8BUfm0b5kZ4SApSRUUI=(MethodBase #=z98vSkdI=, Boolean #=zCYKjnzs=) in Aspose.PDF.dll:token 0x6000523+0x219
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zYu8sg5Q6vK9aX2Q9Wzwy9ga6rEsX2k8CNVIAd_s=(#=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY= #=z98vSkdI=, #=qn4I72mRO2A6RnW4nnAmo6RlngxYRRgCXU7eGrEC6RJM= #=zCYKjnzs=) in Aspose.PDF.dll:token 0x6000448+0x0
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zJoMkBfERnZjZIOkK0g==() in Aspose.PDF.dll:token 0x6000505+0x0
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=z55LysC60mxI2D2ple1lW5XFgb4leLS10Fw==(Boolean #=z98vSkdI=) in Aspose.PDF.dll:token 0x600050d+0x62
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zfQcQfzCbVo9Kz6uVkySBHdG4FtLEPU2_Lql__hm3ENMt(Object #=z98vSkdI=) in Aspose.PDF.dll:token 0x600050b+0x0
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=z8oBKkxDjVXLBXYrt7fQRRAY=() in Aspose.PDF.dll:token 0x60004e0+0xd
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zEM03Jg8R9RcPxWY9HemmMgok3siOrmGTdgR9lnU=(Object #=z98vSkdI=, UInt32 #=zCYKjnzs=) in Aspose.PDF.dll:token 0x60004bd+0x169
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=z55LysC60mxI2D2ple1lW5XFgb4leLS10Fw==(Boolean #=z98vSkdI=) in Aspose.PDF.dll:token 0x600050d+0x72
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zVy_XAqy52iRtG4gnSfrZcceJdXX$CmZnFoN69W8=() in Aspose.PDF.dll:token 0x60004e6+0x0
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zQOsefAvEabeNZUDSUfVAMlpX1BSFlO4_eO7Dv8E=(Object[] #=z98vSkdI=, Type[] #=zCYKjnzs=, Type[] #=zMomoXC0=, Object[] #=zkksRuto=) in Aspose.PDF.dll:token 0x6000525+0xb3
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zelBBmzIM5OAmcq4pm$FDVI8=(Stream #=z98vSkdI=, String #=zCYKjnzs=, Object[] #=zMomoXC0=, Type[] #=zkksRuto=, Type[] #=zF43UUPI=, Object[] #=zEj6apbg=) in Aspose.PDF.dll:token 0x6000539+0x10
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=z3yni0SeI5QXMd0U26itbEIA=(Stream #=z98vSkdI=, String #=zCYKjnzs=, Object[] #=zMomoXC0=) in Aspose.PDF.dll:token 0x60004ba+0x0
at #=qsUQXwUyaHwW4I7AeCurnx$8GdUlq7vvT28qjVCyY0DY=.#=zAWQ7pm8Mj0qCfFyAu1$yjD0=(Stream #=z98vSkdI=, String #=zCYKjnzs=, Object[] #=zMomoXC0=) in Aspose.PDF.dll:token 0x6000487+0x0
at Aspose.Pdf.License.SetLicense(Stream stream) in Aspose.PDF.dll:token 0x6020193+0x12

@aihtos.r

I request you to please share the license file privately with us by clicking my name icon and using Message option to send privately. Please do notify us here once you have shared the license privately.

int_1.jpg
Здравствуйте,

Отправил файл лицензии в сообщении
https://forum.aspose.com/t/setlicense-throw-exception/232718

I use Net6 preview 6, and VisualStudio2022 17.0.0 preview 2.1

С уважением,
Кайгородов Алексей

Генеральный директор
ООО “Стройформ”
mailto:aleksey.kaygorodov@stroyform.ru
тел: 8(901)530-3145

@aleksey.kaygorodov

I can not reproduce the issue. I request you to share more details like if the license fails sometimes or every time when you set it? Please share a sample application reproducing the issue.

Project.zip (34.1 KB)

Re: [Free Support Forum - aspose.com] [Aspose.PDF Product Family] SetLicense throw exception Throw exception this function: ModuleMacros.ActivateAsposePdf(true);

int_1.jpg
Hi Fayyaz,

Sample in attachments.
Password: 112233

Throw exception this function: ModuleMacros.ActivateAsposePdf(true);

С уважением,
Кайгородов Алексей

Генеральный директор
ООО “Стройформ”
mailto:aleksey.kaygorodov@stroyform.ru
тел: 8(901)530-3145

(Attachment Test.rar is missing)

@aleksey.kaygorodov

Please share the Test.rar file as a zip file because it is missing as attachment. Please minimize the code reproducing the issue.

Test.zip (9.2 KB)

@aihtos.r

We are checking it and will get back to you soon.

How long does your "will get back to you soon"last? It’s already been 2 months. We can’t release our program because your library is not working.You have released two versions 21.8 and 21.9 and still haven’t fixed the bug. Microsoft has released two VisualStudio2022 studios 17.0.0-preview3 and 17.0.0-preview4. DotNet6 preview 7 and rc1. And you still haven’t fixed it.

@aihtos.r

We are sorry for the inconvenience. An investigation ticket with ID PDFNET-50582 has been created in our issue tracking system with high priority. We will update you shortly and we appreciate your patience.

@aihtos.r

Could you please check and share your feedback if this code is working correctly on older versions of .NET. For example, .NET 4.5.

It’s work correctly in Net 461, Core 5, Core 6 prev2.
After update to Net 6 prev 6 it’s throw exception.

In our project we should change all function .Read() at MemoryStream and CryptoStream because it read not all bytes in Core 6 prev 6. And we change all place from this:
int cnt = csDecrypt.Read(fromEncrypt, offset, length);

to this:
int cnt = csDecrypt.Read(fromEncrypt, offset, length);

while ((cnt > 0) && (length > 0))
{
length -= cnt;
summa += cnt;
offset += cnt;
if (length > 0)
cnt = csDecrypt.Read(fromEncrypt, offset, length);
}

@aihtos.r

Thank you for the feedback. We are looking into this.

How long does your “high priority”? It’s already been 3 months. We can’t release our program because your library is not working. Microsoft has released VisualStudio2022 preview3-4-5. DotNet6 rc1 rc2. And you still haven’t fixed it.

@aihtos.r

We have made initial investigations and narrowed down the issue. However, it is still unresolved. We request for your patience and will share feedback with you as soon as the issue will be fixed.

.NET 6 is released now. I cannot use Aspose PDF anymore, the “SetLicense()” method throws “Exception of type ‘System.Exception’ was thrown”. It works fine with .NET 5. Could you please release a bugfix urgently?

Attached is a simple solution with two projects that are exactly the same, but one is for .NET 5, the second one is for .NET 6. Just put a correct license file named “Aspose.Total.NET.lic” in the output directory and run. .NET 5 version works fine, .NET 6 version throws an exception.

AsposePdfLicenseBug.zip (2.1 KB)

2 Likes

Same problem here. .Net 6 is released and we can not upgrade because SetLicense doesn’t work in Aspose.PDF 21.2.0.0 or 21.11.0 (latest)…but it works in Aspose.Words however!

System.Exception
HResult=0x80131500
Message=Exception_WasThrown
Source=Aspose.PDF
StackTrace:
at #=qxAsi07iSgr$IoHvuXjuqyXspkpaf$LkIaBoLjQxdm0k=.#=z4xDo39F9MdcGEm2wZYiF18a63TKRox9SPw==(Object #=zXu3sMwY=)
at #=qxAsi07iSgr$IoHvuXjuqyXspkpaf$LkIaBoLjQxdm0k=.#=zvrbWkL8JkJ125VSOQHEEUIFQ_sEpILZ2yAqT2T8=()
at #=qxAsi07iSgr$IoHvuXjuqyXspkpaf$LkIaBoLjQxdm0k=.#=z0KicvzDdXSMCQk00xw0yuIiP3vup1z6h0Io10CuZdbEL(Object #=zXu3sMwY=, UInt32 #=zmrllAUM=)
at #=qxAsi07iSgr$IoHvuXjuqyXspkpaf$LkIaBoLjQxdm0k=.#=zTut2MhEvThnrairR$DqretA_oPYFbx5xyQghPjw=(Boolean #=zXu3sMwY=)
at #=qxAsi07iSgr$IoHvuXjuqyXspkpaf$LkIaBoLjQxdm0k=.#=z2AD4woqtYDAch5HflGqcDThFjMyzr77Yfw==(Object[] #=zXu3sMwY=, Type[] #=zmrllAUM=, Type[] #=z9uLQscI=, Object[] #=zh6LUchc=)
at #=qxAsi07iSgr$IoHvuXjuqyXspkpaf$LkIaBoLjQxdm0k=.#=zLKn_kJ8HhmpAHkw37y7EZ_mQASqZcn51Ag==(Stream #=zXu3sMwY=, String #=zmrllAUM=, Object[] #=z9uLQscI=)
at #=qxAsi07iSgr$IoHvuXjuqyXspkpaf$LkIaBoLjQxdm0k=.#=zXJkEJnx6nfALRFdrX0$KhrUbrSrscmp42Q==(Stream #=zXu3sMwY=, String #=zmrllAUM=, Object[] #=z9uLQscI=)
at Aspose.Pdf.License.SetLicense(Stream stream)
at Agile360.Logic.WordTemplates.Agile360WordLogic.Start(SchemaBuilder sb) in C:\Code\Agile360\Agile360.Logic\WordTemplates\Agile360WordLogic.cs:line 18

1 Like

This really is unacceptable. You guys have had months to deal with this. The libraries are supposed to be .NET Standard compatible. The only reason they could be failing like this is if you were using reflection stupidly or something with the obfuscation (my guess).

It’s bad enough that the 20.0 series does this but now if I want a fix I have to re-up my license. Why should I when even the new releases have problems like this?

Very disappointing and the latest in a long line of bugs that we’ve seen in this very expensive platform.

PS - to all, the way I deal with most Aspose bugs is gonna be the way I deal with this one. Keep all your Aspose use in a separate command line process or windows service and invoke it as needed. Then you can use .net framework for that process and .net6 for your actual app.

@bpp @swen.kusel @peter0302

This ETA for this issue is Aspose.PDF for .NET 21.11 which will be released soon. We request for your patience and will share the good news with you as soon as the issue will be fixed.

We are sorry for the inconvenience.

1 Like