209
Views
16
Comments
[Ultimate PDF] Could not load file or assembly 'System.Net.Http, Version=4.0.0.0 on Platform 11.9.0
Question
Forge component by Leonardo Fernandes
15
Published on 08 Jan 2021

Good Morning,

We updated our OutSystems Platform to 11.9.0 and now we are getting an error with Ultimate PDF when trying to load the module.  Would you need to push out an update to your component to fix this issue so it's compatible with the latest version of System.Net.Http 4.6 used with 11.9.0.


Ultimate PDF is looking for System.Net.Http, Version=4.0.0.0 and it's not finding it as it depends on it for methods so when it's not found it throw the following error:

Protocol error(Page.navigate): Target closed. (NetworkManager failed to process Network.requestWillBeSent. Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..    at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)

Rank: #52871

Hi Justin,


We're having the similar error (Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified) on an own developed espace, which uses no external extensions... 


We're still trying to chase the problem but no luck yet.


I will post you something if i find anything that might help you.



Rank: #9632

hi, may I know how you fixed this problem?

mvp_badge
MVP
Rank: #17

Hi,

Maybe this is caused of the Forge compone uses an extension with references to older versions of microsoft assemblies. 

Platform 11.9 upgrades Microsoft.AspNetCore and Microsoft.Extension libraries to the latest 2.1 LTS (Long-Term Support) versions. (RRCT-2896) This could be the cause of the references to break. 

You could try to open the extension in microsoft visual studio and see if there are outdated microsoft assemblies referenced, fix them and rebuild the project.

Regards,

Daniel

Rank: #4054

Here we solve by opening the extension and recompiling

Rank: #13172

Rafael Salomão wrote:

Here we solve by opening the extension and recompiling

 

Can you be more specific on the steps you took to recompile & fix this issue?  I have tried recompiling and even updating all of the Nuget packages, but we still have this same error.


Thanks!

Ross

Rank: #4054

Ross Hoaglund wrote:

Rafael Salomão wrote:

Here we solve by opening the extension and recompiling

 

Can you be more specific on the steps you took to recompile & fix this issue?  I have tried recompiling and even updating all of the Nuget packages, but we still have this same error.


Thanks!

Ross

 

 Hi Ross,

First, open the extension, update the assemblies then compile the solution.

Second step, and I think the main one, was to change the deploy action to "ignore" in System.net.Http.dll

Before:

After:


Publish the extension and republish your modules.

 

Rank: #13172

Rafael Salomão wrote:

Ross Hoaglund wrote:

Rafael Salomão wrote:

Here we solve by opening the extension and recompiling

 

Can you be more specific on the steps you took to recompile & fix this issue?  I have tried recompiling and even updating all of the Nuget packages, but we still have this same error.


Thanks!

Ross

 

 Hi Ross,

First, open the extension, update the assemblies then compile the solution.

Second step, and I think the main one, was to change the deploy action to "ignore" in System.net.Http.dll

Before:

After:


Publish the extension and republish your modules.

 


 

 Thanks Rafael!!  Ignoring the System.net.http.dll was the trick!

Rank: #9632

Rafael Salomão wrote:

Ross Hoaglund wrote:

Rafael Salomão wrote:

Here we solve by opening the extension and recompiling

 

Can you be more specific on the steps you took to recompile & fix this issue?  I have tried recompiling and even updating all of the Nuget packages, but we still have this same error.


Thanks!

Ross

 

 Hi Ross,

First, open the extension, update the assemblies then compile the solution.

Second step, and I think the main one, was to change the deploy action to "ignore" in System.net.Http.dll

Before:

After:


Publish the extension and republish your modules.

 


 What a pity. Your shared solution is great. But we still can't solve our problem, now below errors occurs:


What else can we do?

 

Rank: #4054

Cathy Wu wrote:

...

Hi Cathy, it looks like you have a certificate issue on that page that opens the pdf, or

It could also be the wrong date and time on the server.

mvp_badge
MVP
Rank: #5

Thanks Daniël and Rafael for your solutions!

A new version was released, that should solve this issue.


Cathy Wu, your latest error is related to invalid SSL certificates. A typical solution is to use a relative URL such as "/Module/Screen.aspx" instead of an absolute URL. Let me know if that fixes your issue.

Rank: #9632

Leonardo Fernandes wrote:

Thanks Daniël and Rafael for your solutions!

A new version was released, that should solve this issue.


Cathy Wu, your latest error is related to invalid SSL certificates. A typical solution is to use a relative URL such as "/Module/Screen.aspx" instead of an absolute URL. Let me know if that fixes your issue.

 Great, thanks for your reminding. The issue is fixed in this way.

 

Rank: #2286

I am running into the same problem. After ignoring the System.Net.Http.dll and trying to compile, I get the following compilation error:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 

Browser\BrowserUtils.cs(124,31): error CS0012: The type 'JToken' is defined in an assembly that is not referenced. You must add a reference to assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. 

Browser\BrowserUtils.cs(124,36): error CS0411: The type arguments for method 'Page.EvaluateFunctionAsync<T>(string, params object[])' cannot be inferred from the usage. Try specifying the type arguments explicitly. 

Browser\BrowserUtils.cs(189,24): error CS0012: The type 'JToken' is defined in an assembly that is not referenced. You must add a reference to assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. 

Browser\BrowserUtils.cs(189,29): error CS0411: The type arguments for method 'Page.EvaluateExpressionAsync<T>(string)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

I have already tried reincluding the dependency in Visual Studio, but this causes that app.config is not found. Solving one error seems to lead to the following.

Rank: #9632

You may try to find the referred path of missing dll , then remove them and re-add them into the component project. 

mvp_badge
MVP
Rank: #5

Hi Remco. Did you overcome this issue?

Rank: #2286

Hi Leonardo, thanks for reaching out.

The NewtonSoft was solved, but unfortunately we now keep on having a list of other issues when trying to compile the extension (in order to ignore the dll). We, with multiple colleagues, have tried several times to re-download the module from the forge, but we keep having this issue.

Browser\BrowserExecutionContext.cs(2,7): error CS0246: The type or namespace name 'PuppeteerSharp' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(3,7): error CS0246: The type or namespace name 'PuppeteerSharp' could not be found (are you missing a using directive or an assembly reference?) 

PDF\PDFUtils.cs(1,7): error CS0246: The type or namespace name 'PdfSharp' could not be found (are you missing a using directive or an assembly reference?) 

PDF\PDFUtils.cs(2,7): error CS0246: The type or namespace name 'PdfSharp' could not be found (are you missing a using directive or an assembly reference?) 

UltimatePDF.cs(11,7): error CS0246: The type or namespace name 'PuppeteerSharp' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(1,7): error CS0246: The type or namespace name 'PuppeteerSharp' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(22,17): error CS0246: The type or namespace name 'BrowserFetcher' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(40,17): error CS0246: The type or namespace name 'NavigationOptions' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(31,16): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(35,16): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(45,42): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(51,37): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

PDF\PDFUtils.cs(13,26): error CS0246: The type or namespace name 'PdfDocument' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(55,68): error CS0246: The type or namespace name 'CookieParam' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(55,90): error CS0246: The type or namespace name 'ViewPortOptions' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(55,116): error CS0246: The type or namespace name 'PdfOptions' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(55,136): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(99,73): error CS0246: The type or namespace name 'CookieParam' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(99,95): error CS0246: The type or namespace name 'ViewPortOptions' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(99,121): error CS0246: The type or namespace name 'ScreenshotOptions' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(99,148): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(126,46): error CS0246: The type or namespace name 'Page' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserExecutionContext.cs(126,61): error CS0246: The type or namespace name 'PdfOptions' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(55,44): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

Browser\BrowserUtils.cs(63,37): error CS0246: The type or namespace name 'RevisionInfo' could not be found (are you missing a using directive or an assembly reference?) 

mvp_badge
MVP
Rank: #5

It looks like you need to open the extension in Visual Studio, and build it in there. Visual Studio will download these dependencies automatically.