43
Views
49
Comments
Solved
[Ultimate PDF] Method 'DisposeAsync' in type 'PuppeteerSharp.Browser'
Forge component by Leonardo Fernandes
Application Type
Traditional Web
Platform Version
11.10.0 (Build 22422)


Hello,

We made a functionality using Ultimate PDF, and it worked just fine for more than 1 month,

Today suddenly we started getting this error:


I made a simple traditional web app to check if it was something with the original app but has the same error.

In my personal environment everything works fine.

mvp_badge
MVP
Solution


Carlos, I can confirm you have the ardo.DatabaseProvider.PostgreSQL.dll installed on your application, which cause the incorrect version of System.Threading.Tasks.Extensions.dll to be included. Both dlls can be found in the bin2 folder inside the zip file you sent me.

If you are not using PostgreSQL, then I would reach out to OutSystems Support and ask them to uninstall this database provider, or install a newer version I have built: https://github.com/leonardo-fernandes/ardoPostgreSQL/releases/tag/1.0.3


Thanks.

Hi I have the same error here. Did you manage to solve it?

Not yet. I already sent a direct message to the component's developer but got no answer.

mvp_badge
MVP

Hi. Could you send me a screenshot of ServiceCenter, showing the list of versions for the UltimatePDF extension? Something like this:


Also please download the published version of the extension and send it to me.

Thanks

Leonardo, 

I actually deleted the full component and installed it again from Forge just this morning (and the original problem continues) :

UltimatePDFv2.zip

Hi to solve that was necessary to go to c:\windows\temp and remove the folder .local-chromium after doing that in the next request the component will create it again with correct permissions.

That was one of the first things I did, and it didn't work.


We just upgraded from Platform version 11.8.2 to 11.10.3 and now we are getting this same error.  Anyone figure out how to solve this?


mvp_badge
MVP

Nelson, I have published a new version that might fix this issue. But since I could not reproduce this issue, I would like you to test and please confirm if it really fixes it.

The version is 2.2.4 and is still under development, I will mark it as stable if you confirm it fixes your problem.

Thanks.

We just downloaded it and are trying it in our environment.  I will let you know if this corrects the issue for us. Thanks for the quick turn around on this.

Leonardo, doesn't look like this fixed the issue. We are still seeing the error in the logs.


Error:

An error occurred while generating the pdf for <Page URL>: Method 'DisposeAsync' in type 'PuppeteerSharp.Browser' from assembly 'PuppeteerSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. 


Stack:

An error occurred while generating the pdf for <Page URL>: Method 'DisposeAsync' in type 'PuppeteerSharp.Browser' from assembly 'PuppeteerSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at ssUltimatePDF.Actions.ActionPrintPDFProxy(HeContext heContext, String inParamURL, String inParamTemporaryFolder, Int32 inParamBrowserRevision, RCViewportRecord inParamViewport, RCPaperRecord inParamPaper, String inParamSessionCookieDomain, Byte[]& outParamPDF)
at ssUltimatePDF.Actions.ActionPrintToPDF_Advanced(HeContext heContext, String inParamURL, String inParamPaperSize, String inParamMarginSize, Byte[]& outParamPDF)

mvp_badge
MVP

Did you republish the entry module that invokes UltimatePDF?

We did. We did a full compile republish of the entry module and the error remains.

I also confirm the issue continues.

I have :

  • Disabled Content Security Policy (we had another meanwhile corrected separate issue with Lifetime and I wanted to make sure it was not impacting this one)
  • Published a full solution
  • Updated UltimatePDF
  • Published the test application

Got exact same error in UltimatePDF.

We can get away with Html2Pdf, but I really prefer this one.

mvp_badge
MVP

Please install the following solution, which will download all files from the compiled application. With those files I might be able to reproduce the issue, or at least investigate them further.

UltimatePDFTroubleshoot.oap

The file is bigger than the allowed 4 Mb (it's 15Mb).

Where do you want me to send it?

mvp_badge
MVP

Hi Nelson.

I tracked down the difference between your environment and a healthy one is on a dll called System.Threading.Tasks.Extensions.

The DisposeAsync method needs to reference the System.Threading.Tasks.ValueTask class, but on your environment that class does not exist. Check below, the version 4.1.0.0 is the one found on your environment, the version 4.2.0.1 is found on a healthy environment.


The correct dll version is shipped with the UltimatePDF extension. So the incorrect version must be coming from either another extension (must be from a system components extension since UltimatePDF has no other dependencies) or from the OutSystems platform itself.


Either way, I suggest you create a support case. You can install this same troubleshooting solution on two environments, download the zip files, then submit both on the support case for comparison. Let me know what is the outcome of that.


Thanks.

Nelson - Did you get anywhere with support on this?  I just looked at the Tasks.Extensions.dll in our on-premises install and they are exactly the same in our environment that works and the one that fails.  We just upgraded our DEV and QA platforms to the latest 11.10.3 and this fails there. We have not upgraded our Pre-Prod or Prod and it still works there, but the DLLs match after looking at them on the server.

Leonardo - Does your extension include the extension DLL as copy local?  I tried to open the extension in integration and recompile (which it does just fine), but I don't see the extension NuGet package as a dependency.  I'm guessing it is coming from the Puppetteer Package.

I'm in a call with Outsystem's support just now.

I will let you know the outcome.

We have 11.10.0.

Okay - I see what the error is now.  The Pupperteer package implemented the DisposeAsync method in it's latest update, but on our installs the Extensions package is not getting updated to the version they used in the NuGet package which included the new ValueTask class.  I just dotPeeked the working dlls in our pre-prod and the not working dlls in DEV. The puppeteer dlls is different, but the TasksExtension dll is the same which is where our error is coming from. 

Nelson - Thanks - I figure if they fix it in your environment, it will fix it in mine. If you hadn't started a case, I was going to.



There's no solution still.

They need to analyze further.

I will keep you informed.

Thanks.  So I was trying to do some troubleshooting myself.  I was able to open the extension in Integration Studio and when you compile it, it downloads all the correct DLLs including the one in question.  But if you then try to publish that solution, it doesn't update the dll because it doesn't see it as new so the old one stays on the server.  

Leonardo  - I don't think OS uses the packages.config, but I noticed yours has 4.5.1 for the Tasks.Extensions package, but Puppeteer requires 4.5.2 or greater. Like I said, when I open in Integration Studio all the correct DLLs are downloaded and it compiles successfully, but it just doesn't see the Extensions DLL as new so it doesn't overwrite it.

mvp_badge
MVP


Jeremy, I didn't understand your comment. Do you know where the "old" dll is coming from?

That is the part that I don't quite understand.  I opened your extension in Integration Studio and recompiled it. When I do that, I get a new System.Threading.Tasks.Extensions (v 4.2.0.1) DLL in the bin folder. But when I publish the solution to the server, that DLL doesn't publish.  It keeps the original DLL that came with the first install of the application. In our case and probably Nelson's case, the one that doesn't have the new ValueTask class.  What I did notice is the Tasks Extension comes from a NuGet package and the new DLL comes from the 4.5.2 or greater version.  I also observed your NuGet "package.config" file had the 4.5.1 in it. From my understanding of NuGet, that is the minimum version the package can accept.  What I don't know is does OutSystems use this when they compile the extension during deployment.  If so, I would assume they are seeing that the DLL doesn't need to be updated because the 4.5.1 version is what is currently installed in the extension espace in IIS.

mvp_badge
MVP

Nelson, could you retry testing using the latest version of Ultimate PDF?

The latest version launches the browser from a service module, which doesn't include any dependencies and is less likely to have conflicting DLLs (unless the conflict comes from dependencies of the platform itself).


If it doesn't fix the issue... I did notice that the zip you sent me included DLLs for connecting to Postgres databases. Are you using any extension or database connector for Postgres (or Redshift or Aurora)?

Hello, I will try and report back.

Yes we had to import some tables from Postgres in an extension, and we use the details from this article https://www.outsystems.com/forums/discussion/14992/the-postgresql-database-connector-by-ardoric/ to set up the connections.

Same exact error:


An error occurred while generating the pdf for <server>/PDF_Debug/pdfreport: Method 'DisposeAsync' in type 'PuppeteerSharp.Browser' from assembly 'PuppeteerSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Same here. We installed the 3.0.0 version and it still gives the DisposeAsync error.

I dotPeek'd the DLL that is put on the server and it is still the 4.1.0.0 version of the tasks extension dll. I just don't understand why OutSystems will not update that dll for this extension.

Actually, Outsystems is also pointing to the Postgres extension.

We are still looking into it better, but it seems it has some to do with it.


Will let you know.

Okay - We are using that Postgres extension as well.

Looking at it, it does make since. The Postgres extension is installed in the plugins/database folder with the 4.1.0.0 version of the Tasks.Extension DLL and that probably gets loaded to the web before the PDF extension from a platform standpoint. Crazy

mvp_badge
MVP

I have forked the PostgreSQL connector and upgraded this dll. Please install the new release, then republish all your modules.

https://github.com/leonardo-fernandes/ardoPostgreSQL/releases/tag/1.0.2


I also recommend a regression test on your PostgreSQL integration to make sure this doesn't introduce any side effects.

Hello,

After installing and confirming the Postgres works normally in all places we use it, I get a new error in UltimatePDF :

Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. 

I've deleted UltimatePDF and installed again from Forge but same error.

In the running folder there is the new dll.

Also using the troubleshoot app, I get the new dll in the download.

mvp_badge
MVP


Could you recompile the troubleshooting solution I sent you earlier, and send the zip file to me?

mvp_badge
MVP

Nelson, please try again with the version 3.0.1. I have downgraded the Newtonsoft.Json dependency and hopefully it's now compatible with your environment.

Now it works!

I'm having another error in one of my apps, and need to understand if it's related to the Postgres dll.

"Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. "

After that I'll mark this as solved.

That dll is mentioned here :

https://success.outsystems.com/Documentation/How-to_Guides/Integrations/How_to_use_.NET_Standard_libraries_in_OutSystems_extensions


"Note: Sometimes you need to include a few system assemblies in your extension, for example System.Runtime.CompilerServices.Unsafe.dll. This won't cause any issues. "


Well, I had to go back to the original Postgres dlls because the connections stopped working in real time.

The queries worked in ServiceStudio but not in real time, giving the error : 

"Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. " 

I've been putting Html2Pdf to work meanwhile, and it's working fine.

I'd prefer to use Ultimate PDF, but it seems it's not possible, and I don't have the time, at the moment, to look into it more.

I still have the support case open and maybe Outsystems will provide any insight. I'll let you know.

Thanks for all the help.

At least we identified the issue. 

mvp_badge
MVP

Hi Nelson. If you want to give it another try, I followed the advice from the documentation you've provided and published a new version.

Same Puppeteer error.

I think that the Postgres plugin should have the System.Runtime.CompilerServices.Unsafe dll.

I haven't been able to contact the Postgres plugin developer....

mvp_badge
MVP

Hi Nelson. I got my hands on a on-prem environment, installed PostgreSQL, the ardoPostgreSQL connector, and UltimatePDF.

Turns out the last error you were experiencing was related to a dependency introduced in the new version of System.Threading.Tasks.Extensions - the new version depends on System.Runtime.CompilerServices.Unsafe, while the old didn't.

So it's just a matter of including this dll into the ardoPostgreSQL connector. I have released a new version of that connector if you want to give it a try:

https://github.com/leonardo-fernandes/ardoPostgreSQL/releases/tag/1.0.3

Hi All, sorry for waking up this post,  but as is related and this one is not closed.

Just did the upgrade following the steps in the tutorial, but got the same errors.

So, anyone found a solution to this problem, in my case I dont have any PostgreeSQL relation


Thanks in advance

Cheers,

Carlos Lessa

mvp_badge
MVP

Hi Carlos.

Could you please install Ultimate PDF Management and download the troubleshooting zip? This will include all dll files that are being used by your Ultimate PDF runtime. With that information, I will be able to find which dll is causing this issue.

Thanks Leonardo,

I sent you PM with the link of the zip.

Cheers,

Carlos Lessa

mvp_badge
MVP
Solution


Carlos, I can confirm you have the ardo.DatabaseProvider.PostgreSQL.dll installed on your application, which cause the incorrect version of System.Threading.Tasks.Extensions.dll to be included. Both dlls can be found in the bin2 folder inside the zip file you sent me.

If you are not using PostgreSQL, then I would reach out to OutSystems Support and ask them to uninstall this database provider, or install a newer version I have built: https://github.com/leonardo-fernandes/ardoPostgreSQL/releases/tag/1.0.3


Thanks.

Thanks Leonardo, I will install the new version and check if will solve the problem.

Cheers

Thanks Leonardo, I installed the one you provided and that worked just fine.

Thanks for the help, you deserve the solution for the post ;) 

Cheers,

Carlos Lessa


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.