686
Views
26
Comments
Extension error relating to Newtonsoft.Json dll
Question

I am trying to use an extension I recently built, but every time I try calling an action in that extension I get the following error:

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 believe a third party library I am using references Newtonsoft.Json version 12, but I noticed that Integration Studio does not allow you to include the Newtonsoft.Json.dll in your extension when you publish it.

I tried removing the reference in my solution (I don't directly call it so this doesn't cause any build errors), but I get the same error as above when trying to call the extension module.

I have also tried manually setting the path to a copy of the dll in the Integration Studio folder (instead of the path to the extension's bin folder), but the same error occurs then.

Has anyone else had a problem similar to this?

I'm using Integration Studio version 11.

mvp_badge
MVP
Rank: #17

Hi,

Why do you think you cannot include the file ?

In service studio you can add files on the reference folder in the solution explorer or through nuget.

Yo can include 3thnosrty  libraries as you would do if you build other applications with service studio.

Regards,

Daniel

Rank: #32037

Daniël Kuhlmann wrote:

Hi,

Why do you think you cannot include the file ?

In service studio you can add files on the reference folder in the solution explorer or through nuget.

Yo can include 3thnosrty  libraries as you would do if you build other applications with service studio.

Regards,

Daniel

I can add the library to my own solution without issue, but when I try including that specific library with the extension in Integration Studio I am given a warning message that states I cannot include it. I'm not able to attach a screen shot to show this right now, but I'll add one when I am able to. 

To get it included on the server it somehow must be present on the build server also, what kind of application are you building, web or mobile ? 

regards,

Wim

Rank: #32037

Wim van den Brink wrote:

To get it included on the server it somehow must be present on the build server also, what kind of application are you building, web or mobile ? 

regards,

Wim

This is being used in a web application.


mvp_badge
MVP
Rank: #96

Hello Trevor


I created an empty extension in Integration Studio 11. See the picture below, the extension already has Newtonsoft.json dll in it. The version was 11.xx. 


From VS, I opened the project and via Package Manager, installed Newtonsoft 12. See the screenshot below, Integration studio, updates the dll properly. 

Hope it helps !!!. 


Rank: #32037

I've done the same steps already, but this doesn't solve the actual problem I am experiencing. I can add the Newtonsoft.Json dll to my project without issue. The extension publishes without issue as well. However when I try calling on my extension I get the error message:

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 can verify that the dll is listed in the resources in Service Center, but I suspect the version is incorrect. I don't see a place to view the version number directly in Service Center though so I'm only guessing on that.



Rank: #82704

Trevor wrote:

I've done the same steps already, but this doesn't solve the actual problem I am experiencing. I can add the Newtonsoft.Json dll to my project without issue. The extension publishes without issue as well. However when I try calling on my extension I get the error message:

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 can verify that the dll is listed in the resources in Service Center, but I suspect the version is incorrect. I don't see a place to view the version number directly in Service Center though so I'm only guessing on that.




I'm having the same issue with the Newtonsoft.Json.dll file.  When I publish my extension, I get an overwrite warning, but the file is overwritten with a file which is not the latest version.  The last modified date of 03/24/2018 17:44:14 coincides with the 11.0.2 version. However, using version 11.0.2 did not fix the issue for me either. I'm still getting the same error Trevor gets.

Rank: #32037

Kyle Tipton wrote:

Trevor wrote:

I've done the same steps already, but this doesn't solve the actual problem I am experiencing. I can add the Newtonsoft.Json dll to my project without issue. The extension publishes without issue as well. However when I try calling on my extension I get the error message:

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 can verify that the dll is listed in the resources in Service Center, but I suspect the version is incorrect. I don't see a place to view the version number directly in Service Center though so I'm only guessing on that.




I'm having the same issue with the Newtonsoft.Json.dll file.  When I publish my extension, I get an overwrite warning, but the file is overwritten with a file which is not the latest version.  The last modified date of 03/24/2018 17:44:14 coincides with the 11.0.2 version. However, using version 11.0.2 did not fix the issue for me either. I'm still getting the same error Trevor gets.

Unfortunately I worked with OutSystems support on this issue and was informed that you cannot use later versions of the Newtonsoft.Json dll. There is no workaround that I am aware of. Unless you are able to downgrade your library to use an earlier version that is supported by OutSystems you are just out of luck (which is what happened to me).


Rank: #5287

I think this might be an issue similar to the one I had a number of months ago - apologies if it's not a fix or I misread your current problem.

In your extension, make sure you point your reference at the Newtonsoft version inside the Outsystems instalation folder, eg C:\Program Files\OutSystems\Development Environment 11.0\Integration Studio (references -> add reference -> browse).

Outsystems comes packaged with this verson of Newtonsoft, and I can only assume there's something hardcoded in the depths of it that expects this specific file / version. I don't really understand what's going on, especially since sometimes nuget versions seem to work fine... until they don't. 

Rank: #32037

MichaelR wrote:

I think this might be an issue similar to the one I had a number of months ago - apologies if it's not a fix or I misread your current problem.

In your extension, make sure you point your reference at the Newtonsoft version inside the Outsystems instalation folder, eg C:\Program Files\OutSystems\Development Environment 11.0\Integration Studio (references -> add reference -> browse).

Outsystems comes packaged with this verson of Newtonsoft, and I can only assume there's something hardcoded in the depths of it that expects this specific file / version. I don't really understand what's going on, but when we had our issue it sorted it for us. Of course, being Integration Studio, this isn't documented anywhere, so we had a dozen extensions using Newtonsoft from nuget for months without issue... until we did a platform upgrade and everything broke.

I don't believe we are talking about the same problem. The issue was that I was using a third party library that uses a later version of Newtsonsoft.Json. Outsystems doesn't allow using versions that are newer than the hardcoded version it uses. Speaking with support back in August I confirmed with them that there is no fix for this except using the version they use. I couldn't do that because I didn't have the option of modifying the third party library I was using and it calls functions that don't exist in the Newtsonsoft version that Outsystems uses.

My own solution to this was to just give up on the extension and find another way to do what I needed from within a regular web module.

Rank: #5287

Trevor wrote:

I don't believe we are talking about the same problem. The issue was that I was using a third party library that uses a later version of Newtsonsoft.Json. Outsystems doesn't allow using versions that are newer than the hardcoded version it uses. Speaking with support back in August I confirmed with them that there is no fix for this except using the version they use. I couldn't do that because I didn't have the option of modifying the third party library I was using and it calls functions that don't exist in the Newtsonsoft version that Outsystems uses.

My own solution to this was to just give up on the extension and find another way to do what I needed from within a regular web module.

Oops, I obviously didn't read the whole thread well enough. It seems like it's essentially the same issue but just not as easily solved since it's a third party library.

mvp_badge
MVP
Rank: #7

You have "DLL Hell". This is a well-known problem, and it is especially common with this particular DLL.

https://success.outsystems.com/Support/Enterprise_Customers/Troubleshooting/Why_are_changes_in_a_producer_not_reflected_in_the_consumers%3F_(aka_Library_Hell)

J.Ja

Staff
Rank: #1327

When editing the extension in Visual Studio, try including the Newtonsoft.Json.dll reference from the Integration Studio folder (eg.: C:\Program Files\OutSystems\Development Environment 11\Integration Studio) 

Worked for me.

mvp_badge
MVP
Rank: #10

Update to this thread.

I've marked the following answer as the solution, since it has proved to be the correct one.
Any question, please shoot.

Sérgio Dias wrote:

When editing the extension in Visual Studio, try including the Newtonsoft.Json.dll reference from the Integration Studio folder (eg.: C:\Program Files\OutSystems\Development Environment 11\Integration Studio) 

Worked for me.

 

 

Rank: #25185

Use https://github.com/dotnet/ILMerge to merge all assemblies depending on newer Newtonsoft.Json to extension assembly. This takes custom targets in extension *.csproj file, to be ran after Build target. Look's like solution for me while abusing Google.Apis.* NuGets into extension.

Rank: #223

It's weird, using Nu Package does not work, but including the Newtonsoft.Json.dll reference from the Integration Studio folder (eg.: C:\Program Files\OutSystems\Development Environment 11\Integration Studio)  works :). This must be a bug in Outsystems.

Rank: #24996

Olá pessoal, alguém conseguiu usar alguma versão de newtonsoft.json?


quando XIF foi escrito na versão 10, funcionou perfeitamente, quando migrava para a versão 11, e ao recompilar, perdeu referência ao dll, e nunca mais funcionou.

Rank: #4461

Just a workaround -

Use "System.Text.Json" library instead of Newton. I understand Newton library is widely popular, but if your use-case be handled by Microsoft's "system.text.json" library, then it solves the needs.

Detailed differences- 

https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to#table-of-differences-between-newtonsoftjson-and-systemtextjson



Rank: #32037

Your concern is noted. I was not questioning the validity of the advice. Only pointing out that in my specific case (using a third party DLL that required a later version of this DLL) it wouldn't have solved my issue. Nothing would have short of rewriting the third party DLL myself in such a way that it didn't require the later version of the Newtonsoft JSON DLL. Either way the thread is marked solved and I've not needed assistance with this since I abandoned the extension some time ago. Thank you for following up.

Hi Trevor,


You have to use version 11.0.2, not the last.