For a deeper look into our DataScope Select SOAP API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
6 1 0 6

DSS Rest Api references old Newtonsoft.Json Assembly

In our project we referenced ThomsonReuters.Dss.RestApi.Client.dll which in turn is depending on Newtonsoft.json 9.0.0.

Since we have updated our Project References to Newtonsoft.json 11.0.2 (the latest) we get Assembly Resolve Exception when using DSS.

Is there a version of the DSS Rest API available which references Newtonsoft.Json 11.0.2?

dss-rest-apidatascope-selectdss
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

@32659533-f0f4-474c-99ce-5f920d564ec6, did you try the latest SDK version ? It has Newtonsoft.Json 11.0

Upvotes
Accepted
13.7k 26 8 12

@32659533-f0f4-474c-99ce-5f920d564ec6, the development team just told me that version 12.1 of the SDK (released yesterday Monday 16 July) shipped with version 11.0 of Newtonsoft. The new SDK is available here. I will upload it to the DSS downloads later today.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13.7k 26 8 12

@32659533-f0f4-474c-99ce-5f920d564ec6,

it is true that our C# example application and samples use Newtonsoft.Json version 9.

To check how they behave with version 11, I downloaded the latest Newtonsoft.Json, as a zip file, to be able to manually select which DLL version to test. In Visual Studio I changed the reference from the 9.0 DLL to the portable-net40+win8+wpa81+wp8+sI5 11.0 version (the one highlighted in the screenshot), and ran a few samples and tutorials, which all worked fine. I did not manually edit any other references.

You do not give much detail. Exactly which version of the 11.0 DLL did you use ? Can you try a different one ? The dependencies vary ...


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
6 1 0 6

Hello Christiaan,

thanks for looking into this.

I can imagine that you will not get the error in most of the cases, since it seems that the DSS Api only utilizes Newtonsoft.Json in case of a validation error.

We execute our request as so:

var extractionsContext = new ExtractionsContext(... // settings //)
var request = new CompositeExtractionRequest { IdentifierList = instrumentIdentifierList, ContentFieldNames = ricFieldsArray };
var result = extractionsContext.ExtractWithNotes(request);


This works in the majority of cases! Only irregularly we get an exception that Newtonsoft.Json 9.0.0 could not be found (since we only have Newtonsoft.Json 11.0.2).

Newtonsoft.Json is indeed only used in case something went wrong - specifically where some Validation Error occurs - this is the stacktrace I see:

at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpClientExceptionDecorator.ParseValidationErrors(HttpHeaders headers) at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpClientExceptionDecorator.ParseODataError(String mediaType, String body, HttpHeaders headers) at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpClientExceptionDecorator.<ParseResponseError>d__1b.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpClientExceptionDecorator.<HandleExceptions>d__11.MoveNext() --- End of stack trace from previous location where exception was thrown ---

As you can see, the error occurs within the method "ParseValidationErrors" - which indicates to me that Newtonsoft.Json is only used in case some validation errors are actually returned... I confirmed this by looking at the decompiled source (Reflector).


Does this make sense to you? Can you verify that "ParseValidationErrors" is ever called within your test harness?

Thanks for you help!

Kind regards,
Wolfgang



icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
38.1k 71 35 53

Please try to use binding redirect to redirect assembly versions. For example, the below is configurations in App.config.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea