Thanks Jan, but after reviewing the dependencies, I upgraded PurecloudPlatform version to latest version 237.0.0, This version now references Newtonsoft.json to version 13.0.3 and Restsharp 112.0.0. I also made necessary code changes to align with the updated class names in Purecloud. With these changes, the previous hard dependency issue on Newtonsoft.json has been resolved. However, a new issue has emerged- Restsharp now depends on System.Text.Json v8.0.0.4, while we had updated it to v8.0.0.5 due to known vulnerabilities in 8.0.0.4.
I've attached exception details related to this for reference. I'm currently reviewing all package versions for compatibility. Could you please also take a look from your side?
The error I received when running the script in SQL :
Exception when calling RoutingApi.GetRoutingWrapupcodes: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. at RestSharp.Serializers.Json.SystemTextJsonSerializer..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance[T]() at RestSharp.Serializers.SerializerConfig.<>c__5`1.<UseSerializer>b__5_0() at RestSharp.Serializers.SerializerConfig.UseSerializer(Func`1 serializerFactory) at RestSharp.RestClient.ConfigureSerializers(ConfigureSerialization configureSerialization) at RestSharp.RestClient..ctor(RestClientOptions options, ConfigureHeaders configureDefaultHeaders, ConfigureSerialization configureSerialization, Boolean useClientFactory) at PureCloudPlatform.Client.V2.Client.DefaultHttpClient.BuildRestOptions() at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.CallTokenApi(ApiClient apiClient, String path, String method, List`1 queryParams, Object postBody, Dictionary`2 headerParams, Dictionary`2 formParams, Dictionary`2 fileParams, Dictionary`2 pathParams, String contentType) at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.PostTokenWithHttpInfo(ApiClient apiClient, String clientId, String clientSecret, String redirectUri, String authorizationCode, Boolean isRefreshRequest) at PurecloudImport.Configuration.GetAccessToken(Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\Configuration.cs:line 51 at PurecloudImport.PortWrapUpCode.Port(Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\PortWrapUpCode.cs:line 39 Exception when calling UsersApi.GetUsers who are Active: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. at RestSharp.Serializers.Json.SystemTextJsonSerializer..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance[T]() at RestSharp.Serializers.SerializerConfig.<>c__5`1.<UseSerializer>b__5_0() at RestSharp.Serializers.SerializerConfig.UseSerializer(Func`1 serializerFactory) at RestSharp.RestClient.ConfigureSerializers(ConfigureSerialization configureSerialization) at RestSharp.RestClient..ctor(RestClientOptions options, ConfigureHeaders configureDefaultHeaders, ConfigureSerialization configureSerialization, Boolean useClientFactory) at PureCloudPlatform.Client.V2.Client.DefaultHttpClient.BuildRestOptions() at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.CallTokenApi(ApiClient apiClient, String path, String method, List`1 queryParams, Object postBody, Dictionary`2 headerParams, Dictionary`2 formParams, Dictionary`2 fileParams, Dictionary`2 pathParams, String contentType) at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.PostTokenWithHttpInfo(ApiClient apiClient, String clientId, String clientSecret, String redirectUri, String authorizationCode, Boolean isRefreshRequest) at PurecloudImport.Configuration.GetAccessToken(Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\Configuration.cs:line 51 at PurecloudImport.PortUser.PortUsersByState(String state, String connectionString, Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\PortUser.cs:line 107Exception when calling UsersApi.GetUsers who are Inactive: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. at RestSharp.Serializers.Json.SystemTextJsonSerializer..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance[T]() at RestSharp.Serializers.SerializerConfig.<>c__5`1.<UseSerializer>b__5_0() at RestSharp.Serializers.SerializerConfig.UseSerializer(Func`1 serializerFactory) at RestSharp.RestClient.ConfigureSerializers(ConfigureSerialization configureSerialization) at RestSharp.RestClient..ctor(RestClientOptions options, ConfigureHeaders configureDefaultHeaders, ConfigureSerialization configureSerialization, Boolean useClientFactory) at PureCloudPlatform.Client.V2.Client.DefaultHttpClient.BuildRestOptions() at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.CallTokenApi(ApiClient apiClient, String path, String method, List`1 queryParams, Object postBody, Dictionary`2 headerParams, Dictionary`2 formParams, Dictionary`2 fileParams, Dictionary`2 pathParams, String contentType) at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.PostTokenWithHttpInfo(ApiClient apiClient, String clientId, String clientSecret, String redirectUri, String authorizationCode, Boolean isRefreshRequest) at PurecloudImport.Configuration.GetAccessToken(Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\Configuration.cs:line 51 at PurecloudImport.PortUser.PortUsersByState(String state, String connectionString, Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\PortUser.cs:line 107Exception when calling UsersApi.GetUsers who are Deleted: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. at RestSharp.Serializers.Json.SystemTextJsonSerializer..ctor() --- End of inner exception stack trace --- at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance[T]() at RestSharp.Serializers.SerializerConfig.<>c__5`1.<UseSerializer>b__5_0() at RestSharp.Serializers.SerializerConfig.UseSerializer(Func`1 serializerFactory) at RestSharp.RestClient.ConfigureSerializers(ConfigureSerialization configureSerialization) at RestSharp.RestClient..ctor(RestClientOptions options, ConfigureHeaders configureDefaultHeaders, ConfigureSerialization configureSerialization, Boolean useClientFactory) at PureCloudPlatform.Client.V2.Client.DefaultHttpClient.BuildRestOptions() at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.CallTokenApi(ApiClient apiClient, String path, String method, List`1 queryParams, Object postBody, Dictionary`2 headerParams, Dictionary`2 formParams, Dictionary`2 fileParams, Dictionary`2 pathParams, String contentType) at PureCloudPlatform.Client.V2.Extensions.AuthExtensions.PostTokenWithHttpInfo(ApiClient apiClient, String clientId, String clientSecret, String redirectUri, String authorizationCode, Boolean isRefreshRequest) at PurecloudImport.Configuration.GetAccessToken(Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\Configuration.cs:line 51 at PurecloudImport.PortUser.PortUsersByState(String state, String connectionString, Config config) in E:\azagent\A2\_work\2600\s\PureCloud\c#\PurecloudImport\PureCloudImport\PortUser.cs:line 107 Exception when calling RoutingApi.GetRoutingWrapupcodes: Exception has been thrown by the target of an invocation.Exception when calling RoutingApi.GetRoutingWrapupcodes: Exception has been thrown by the target of an invocation. Exception when calling ConversationsApi.PostAnalyticsConversationsDetailsQuery: Exception has been thrown by the target of an invocation."
------------------------------
Mario Montes
------------------------------
Original Message:
Sent: 06-26-2025 08:36
From: Jan Heinonen
Subject: PurecloudSDK Compatibility
Hello Mario,
Later versions should be compatible.
You can check dependencies for different versions at https://www.nuget.org/packages/PureCloudPlatform.Client.V2/236.0.0#dependencies-body-tab
------------------------------
Jan Heinonen
Contact Center Specialist
GlobalConnect AB
Original Message:
Sent: 06-25-2025 15:16
From: Mario Montes
Subject: PurecloudSDK Compatibility
PurecloudSDK compatability with Newtonsoft.json 13.0.1
We are working on a .Net Upgrade task, and as a part of it we need to upgrade .Net Framework to version 4.8, Newtonsoft.Json version to 13.0.1 (replacing older version 11.0.2) and Restsharp version to latest version (replacing older version 106.3.0).
The current solution has PurecloudPlatform.Client.V2 SDK version of 38.0.0. So, to support all version upgrades we have installed PurecloudPlatform.Client.V2 SDK version 137.0.1 which is compatible with upgraded.Net Framework, Newtonsoft.Json and Restsharp versions. However, we've found that the PurecloudPlatform.Client.V2 SDK has a hard dependency on Newtonsoft.Json version 11.0.2, which is causing compatibility issues during initialization.
Could you please confirm if there is a newer version of the SDK compatible with Newtonsoft.json 13.0.1? Or is there an officially recommended workaround for this conflict?
#PlatformSDK
------------------------------
Mario Montes
------------------------------