From 73926a38bb424a26828352b799255ec287c98938 Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Tue, 22 Apr 2025 15:47:36 +0500 Subject: [PATCH 1/8] Version updated Newtonsoft.Json replaced with System.Text.Json --- README.md | 4 +- Tests/ConfigurationTests.cs | 10 ++--- Tests/JWTRequestHandlerTests.cs | 6 +-- Tests/JwtAuthTests.cs | 7 ++- Tests/TestsBase.cs | 43 +++++++++++-------- examples/GenerateQR/GenerateQR.csproj | 2 +- examples/ReadQR/ReadQR.csproj | 2 +- snippets/Snippets.csproj | 2 +- snippets/dependency.xml | 2 +- src/Api/Configuration.cs | 5 +-- src/Aspose.BarCode.Cloud.Sdk.csproj | 8 ++-- .../RequestHandlers/JWTRequestHandler.cs | 9 ++-- src/Internal/SerializationHelper.cs | 21 +++++---- src/Model/AbstractOpenAPISchema.cs | 43 ++++++++----------- src/Model/BarcodeImageFormat.cs | 6 +-- src/Model/CodeLocation.cs | 6 +-- src/Model/DecodeBarcodeType.cs | 6 +-- src/Model/EncodeBarcodeType.cs | 6 +-- src/Model/EncodeDataType.cs | 6 +-- src/Model/GraphicsUnit.cs | 6 +-- src/Model/RecognitionImageKind.cs | 6 +-- src/Model/RecognitionMode.cs | 6 +-- 22 files changed, 105 insertions(+), 107 deletions(-) diff --git a/README.md b/README.md index d7c0525..921ae1c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Nuget](https://img.shields.io/nuget/v/Aspose.BarCode-Cloud)](https://www.nuget.org/packages/Aspose.BarCode-Cloud/) - API version: 4.0 -- SDK version: 25.3.0 +- SDK version: 25.4.0 ## SDK and API Version Compatibility: @@ -201,7 +201,7 @@ internal static class Program ## Dependencies -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) +- [System.Text.Json](https://www.nuget.org/packages/System.Text.json) ## Licensing diff --git a/Tests/ConfigurationTests.cs b/Tests/ConfigurationTests.cs index 3acfb52..3360344 100644 --- a/Tests/ConfigurationTests.cs +++ b/Tests/ConfigurationTests.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.IO; using Aspose.BarCode.Cloud.Sdk.Api; -using Newtonsoft.Json; +using System.Text.Json; using NUnit.Framework; namespace Aspose.BarCode.Cloud.Sdk.Tests @@ -90,13 +90,11 @@ public void DefaultParamsTest() [Test] public void DeserializeTest() { - using StreamReader file = File.OpenText(Path.Combine( + using FileStream file = File.OpenRead(Path.Combine( TestContext.CurrentContext.TestDirectory, "..", "..", "..", "Configuration.template.json")); - JsonSerializer serializer = new JsonSerializer(); - using JsonTextReader reader = new JsonTextReader(file); - Configuration config = serializer.Deserialize(reader); + var config = JsonSerializer.Deserialize(file); Assert.IsNotNull(config); Assert.AreEqual("Client Secret from https://dashboard.aspose.cloud/applications", config.ClientSecret); @@ -131,7 +129,7 @@ public void SerializationTest() "ApiVersion\":\"4.0\",\"" + "DefaultHeaders\":{}" + "}", - JsonConvert.SerializeObject(config)); + JsonSerializer.Serialize(config)); } } } diff --git a/Tests/JWTRequestHandlerTests.cs b/Tests/JWTRequestHandlerTests.cs index 841ed27..f6bf975 100644 --- a/Tests/JWTRequestHandlerTests.cs +++ b/Tests/JWTRequestHandlerTests.cs @@ -4,12 +4,12 @@ using System.Net; using System.Net.Http; using System.Text; +using System.Text.Json; using System.Threading.Tasks; using Aspose.BarCode.Cloud.Sdk.Api; using Aspose.BarCode.Cloud.Sdk.Internal; using Aspose.BarCode.Cloud.Sdk.Internal.RequestHandlers; using Moq; -using Newtonsoft.Json.Linq; using NUnit.Framework; namespace Aspose.BarCode.Cloud.Sdk.Tests @@ -169,9 +169,9 @@ private static void AssertTokenIsValid(string token) { string firstPartBeforeDot = new string(token.TakeWhile(c => c != '.').ToArray()); byte[] tokenBytes = Convert.FromBase64String(firstPartBeforeDot); - JObject tokenHeader = JObject.Parse(Encoding.UTF8.GetString(tokenBytes)); + JsonElement tokenHeader = JsonDocument.Parse(Encoding.UTF8.GetString(tokenBytes)).RootElement; - Assert.AreEqual("JWT", tokenHeader["typ"]?.ToString()); + Assert.AreEqual("JWT", tokenHeader.GetProperty("typ").GetString()); } } } diff --git a/Tests/JwtAuthTests.cs b/Tests/JwtAuthTests.cs index 37863cc..27ac391 100644 --- a/Tests/JwtAuthTests.cs +++ b/Tests/JwtAuthTests.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using System.IO; using System.Net.Http; +using System.Text.Json; using System.Threading.Tasks; using Aspose.BarCode.Cloud.Sdk.Api; using Aspose.BarCode.Cloud.Sdk.Model; - -using Newtonsoft.Json.Linq; using NUnit.Framework; namespace Aspose.BarCode.Cloud.Sdk.Tests @@ -27,8 +26,8 @@ private async Task FetchToken() FormUrlEncodedContent formContent = new FormUrlEncodedContent(formParams); HttpResponseMessage response = await new HttpClient().PostAsync(TestConfiguration.TokenUrl, formContent); response.EnsureSuccessStatusCode(); - JObject json = JObject.Parse(await response.Content.ReadAsStringAsync()); - string accessToken = Convert.ToString(json["access_token"]); + JsonDocument json = JsonDocument.Parse(await response.Content.ReadAsStringAsync()); + string accessToken = json.RootElement.GetProperty("access_token").GetString(); return accessToken; } diff --git a/Tests/TestsBase.cs b/Tests/TestsBase.cs index e495f60..f5cad09 100644 --- a/Tests/TestsBase.cs +++ b/Tests/TestsBase.cs @@ -3,8 +3,7 @@ using System.IO; using System.Text; using Aspose.BarCode.Cloud.Sdk.Api; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; +using System.Text.Json; using NUnit.Framework; namespace Aspose.BarCode.Cloud.Sdk.Tests @@ -36,38 +35,44 @@ private static Configuration LoadTestConfiguration() "Configuration.json")); if (File.Exists(configFilename)) { - using StreamReader file = File.OpenText(configFilename); - using JsonTextReader reader = new JsonTextReader(file); - JsonSerializer serializer = new JsonSerializer(); - return serializer.Deserialize(reader); + using FileStream file = File.OpenRead(configFilename); + return JsonSerializer.Deserialize(file) + ?? throw new Exception("Configuration file is empty or invalid"); } - Configuration config = LoadFromEnv(); - return config; } private static Configuration LoadFromEnv() { - string jsonStr = JsonConvert.SerializeObject(new Configuration()); - JObject obj = JObject.Parse(jsonStr); - foreach (KeyValuePair i in obj) + // Serialize default config to JSON then to a dictionary + string jsonStr = JsonSerializer.Serialize(new Configuration()); + var dict = JsonSerializer.Deserialize>(jsonStr); + + if (dict == null) + throw new Exception("Default configuration invalid"); + + foreach (var key in new List(dict.Keys)) { - if (!(i.Value.Type == JTokenType.String || i.Value.Type == JTokenType.Null)) - { + var value = dict[key]; + + // Accept strings and nulls (JSON null becomes null here) + if (value != null && !(value is string)) continue; - } - string name = i.Key; - string envName = $"{ENV_NAME_PREFIX}{CamelCaseToUpper(name)}"; + string envName = $"{ENV_NAME_PREFIX}{CamelCaseToUpper(key)}"; string envValue = Environment.GetEnvironmentVariable(envName); if (!string.IsNullOrEmpty(envValue)) { - obj[name] = envValue; + dict[key] = envValue; } } - - return JsonConvert.DeserializeObject(obj.ToString()); + // Serialize back and then deserialize to Configuration + string updatedJson = JsonSerializer.Serialize(dict); + var config = JsonSerializer.Deserialize(updatedJson); + if (config == null) + throw new Exception("Failed to create Configuration from environment variables"); + return config; } private static string CamelCaseToUpper(string name) diff --git a/examples/GenerateQR/GenerateQR.csproj b/examples/GenerateQR/GenerateQR.csproj index c72b0c8..e9d5b37 100644 --- a/examples/GenerateQR/GenerateQR.csproj +++ b/examples/GenerateQR/GenerateQR.csproj @@ -7,7 +7,7 @@ - + diff --git a/examples/ReadQR/ReadQR.csproj b/examples/ReadQR/ReadQR.csproj index c72b0c8..e9d5b37 100644 --- a/examples/ReadQR/ReadQR.csproj +++ b/examples/ReadQR/ReadQR.csproj @@ -7,7 +7,7 @@ - + diff --git a/snippets/Snippets.csproj b/snippets/Snippets.csproj index c72b0c8..e9d5b37 100644 --- a/snippets/Snippets.csproj +++ b/snippets/Snippets.csproj @@ -7,7 +7,7 @@ - + diff --git a/snippets/dependency.xml b/snippets/dependency.xml index 1552ae5..df4026c 100644 --- a/snippets/dependency.xml +++ b/snippets/dependency.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/Api/Configuration.cs b/src/Api/Configuration.cs index 06a82bb..2e677b8 100644 --- a/src/Api/Configuration.cs +++ b/src/Api/Configuration.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; namespace Aspose.BarCode.Cloud.Sdk.Api { @@ -71,7 +70,7 @@ public string JwtToken /// /// Authentication type. /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public AuthType AuthType { get; private set; } /// diff --git a/src/Aspose.BarCode.Cloud.Sdk.csproj b/src/Aspose.BarCode.Cloud.Sdk.csproj index 952e3e6..295ccb9 100644 --- a/src/Aspose.BarCode.Cloud.Sdk.csproj +++ b/src/Aspose.BarCode.Cloud.Sdk.csproj @@ -24,11 +24,11 @@ Aspose.Barcode for Cloud allows you to control all aspects of the image and barc Aspose.BarCode-Cloud Aspose.BarCode Cloud SDK for .NET PackageIcon.png - 25.3.0 + 25.4.0 Aspose - 25.3.0.0 + 25.4.0.0 README.md - https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dotnet/releases/tag/v25.3.0 + https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-dotnet/releases/tag/v25.4.0 true LICENSE.txt true @@ -48,7 +48,7 @@ Aspose.Barcode for Cloud allows you to control all aspects of the image and barc - + diff --git a/src/Internal/RequestHandlers/JWTRequestHandler.cs b/src/Internal/RequestHandlers/JWTRequestHandler.cs index c9f4e6f..5064d60 100644 --- a/src/Internal/RequestHandlers/JWTRequestHandler.cs +++ b/src/Internal/RequestHandlers/JWTRequestHandler.cs @@ -5,7 +5,8 @@ using System.Threading.Tasks; using Aspose.BarCode.Cloud.Sdk.Api; using Aspose.BarCode.Cloud.Sdk.Interfaces; -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Aspose.BarCode.Cloud.Sdk.Internal.RequestHandlers { @@ -198,13 +199,13 @@ public async Task ProcessResponseAsync(HttpResponseMessage response) private class GetAccessTokenResult { - [JsonProperty(PropertyName = "access_token")] + [JsonPropertyName("access_token")] public string AccessToken { get; set; } - [JsonProperty(PropertyName = "expires_in")] + [JsonPropertyName("expires_in")] public long ExpiresIn { get; set; } - [JsonProperty(PropertyName = "token_type")] + [JsonPropertyName("token_type")] public string TokenType { get; set; } } } diff --git a/src/Internal/SerializationHelper.cs b/src/Internal/SerializationHelper.cs index 4b3fca7..623b0d5 100644 --- a/src/Internal/SerializationHelper.cs +++ b/src/Internal/SerializationHelper.cs @@ -3,23 +3,26 @@ using System.Xml; using Aspose.BarCode.Cloud.Sdk.Api; using Aspose.BarCode.Cloud.Sdk.Interfaces; -using Newtonsoft.Json; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Aspose.BarCode.Cloud.Sdk.Internal { internal static class SerializationHelper { + private static readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + PropertyNameCaseInsensitive = true, + }; public static string Serialize(object obj) { try { return obj != null - ? JsonConvert.SerializeObject( - obj, - new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore - }) + ? JsonSerializer.Serialize( + obj, JsonOptions + ) : null; } catch (Exception e) @@ -34,7 +37,7 @@ public static object Deserialize(string json, Type type) { if (json.StartsWith("{", StringComparison.InvariantCulture) || json.StartsWith("[", StringComparison.InvariantCulture)) { - object jObj = JsonConvert.DeserializeObject(json, type); + object jObj = JsonSerializer.Deserialize(json, type, JsonOptions); if (jObj is IToString jToString) { jToString.SetSrcString(json); @@ -48,7 +51,7 @@ public static object Deserialize(string json, Type type) { throw new ApiException(500, e.Message); } - catch (JsonSerializationException jsE) + catch (JsonException jsE) { throw new ApiException(500, jsE.Message); } diff --git a/src/Model/AbstractOpenAPISchema.cs b/src/Model/AbstractOpenAPISchema.cs index 48564c7..cd9be05 100644 --- a/src/Model/AbstractOpenAPISchema.cs +++ b/src/Model/AbstractOpenAPISchema.cs @@ -25,8 +25,8 @@ using System; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -38,35 +38,28 @@ public abstract partial class AbstractOpenAPISchema /// /// Custom JSON serializer /// - public static readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + public static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - MissingMemberHandling = MissingMemberHandling.Error, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + PropertyNameCaseInsensitive = false, + // To ignore comments or trailing commas, set these: + ReadCommentHandling = JsonCommentHandling.Disallow, + UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow, + AllowTrailingCommas = false, }; + /// - /// Custom JSON serializer for objects with additional properties + /// Custom JSON serializer options for objects with additional properties. /// - public static readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + public static readonly JsonSerializerOptions AdditionalPropertiesSerializerOptions = new JsonSerializerOptions { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - MissingMemberHandling = MissingMemberHandling.Ignore, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + PropertyNameCaseInsensitive = false, + + ReadCommentHandling = JsonCommentHandling.Disallow, + AllowTrailingCommas = false, + }; /// diff --git a/src/Model/BarcodeImageFormat.cs b/src/Model/BarcodeImageFormat.cs index 4b2916e..cb46930 100644 --- a/src/Model/BarcodeImageFormat.cs +++ b/src/Model/BarcodeImageFormat.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// Specifies the file format of the image. /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum BarcodeImageFormat { /// diff --git a/src/Model/CodeLocation.cs b/src/Model/CodeLocation.cs index 7250f0b..dee08b5 100644 --- a/src/Model/CodeLocation.cs +++ b/src/Model/CodeLocation.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum CodeLocation { /// diff --git a/src/Model/DecodeBarcodeType.cs b/src/Model/DecodeBarcodeType.cs index 8291f63..0db0b82 100644 --- a/src/Model/DecodeBarcodeType.cs +++ b/src/Model/DecodeBarcodeType.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// See Aspose.BarCode.Aspose.BarCode.BarCodeRecognition.DecodeType /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum DecodeBarcodeType { /// diff --git a/src/Model/EncodeBarcodeType.cs b/src/Model/EncodeBarcodeType.cs index 138a097..451bb01 100644 --- a/src/Model/EncodeBarcodeType.cs +++ b/src/Model/EncodeBarcodeType.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// See Aspose.BarCode.Generation.EncodeTypes /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum EncodeBarcodeType { /// diff --git a/src/Model/EncodeDataType.cs b/src/Model/EncodeDataType.cs index 1045a4b..33df5de 100644 --- a/src/Model/EncodeDataType.cs +++ b/src/Model/EncodeDataType.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// Types of data can be encoded to barcode /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum EncodeDataType { /// diff --git a/src/Model/GraphicsUnit.cs b/src/Model/GraphicsUnit.cs index 0debdc4..db017c0 100644 --- a/src/Model/GraphicsUnit.cs +++ b/src/Model/GraphicsUnit.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// Subset of Aspose.Drawing.GraphicsUnit. /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum GraphicsUnit { /// diff --git a/src/Model/RecognitionImageKind.cs b/src/Model/RecognitionImageKind.cs index 275b31e..deaab6b 100644 --- a/src/Model/RecognitionImageKind.cs +++ b/src/Model/RecognitionImageKind.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// Kind of image to recognize /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum RecognitionImageKind { /// diff --git a/src/Model/RecognitionMode.cs b/src/Model/RecognitionMode.cs index 27def47..9d40ef2 100644 --- a/src/Model/RecognitionMode.cs +++ b/src/Model/RecognitionMode.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; + namespace Aspose.BarCode.Cloud.Sdk.Model { @@ -8,7 +8,7 @@ namespace Aspose.BarCode.Cloud.Sdk.Model /// /// Recognition mode. /// - [JsonConverter(typeof(StringEnumConverter))] + [JsonConverter(typeof(JsonStringEnumConverter))] public enum RecognitionMode { /// From c261b8ca7f2be8aebb4483bab9981161d4c62a05 Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Wed, 23 Apr 2025 11:27:09 +0500 Subject: [PATCH 2/8] Formatting --- src/Aspose.BarCode.Cloud.Sdk.csproj | 2 +- src/Model/BarcodeImageFormat.cs | 1 - src/Model/CodeLocation.cs | 1 - src/Model/DecodeBarcodeType.cs | 1 - src/Model/EncodeBarcodeType.cs | 1 - src/Model/EncodeDataType.cs | 1 - src/Model/GraphicsUnit.cs | 1 - src/Model/RecognitionImageKind.cs | 1 - src/Model/RecognitionMode.cs | 1 - 9 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Aspose.BarCode.Cloud.Sdk.csproj b/src/Aspose.BarCode.Cloud.Sdk.csproj index 295ccb9..736608d 100644 --- a/src/Aspose.BarCode.Cloud.Sdk.csproj +++ b/src/Aspose.BarCode.Cloud.Sdk.csproj @@ -48,7 +48,7 @@ Aspose.Barcode for Cloud allows you to control all aspects of the image and barc - + diff --git a/src/Model/BarcodeImageFormat.cs b/src/Model/BarcodeImageFormat.cs index cb46930..e3f6838 100644 --- a/src/Model/BarcodeImageFormat.cs +++ b/src/Model/BarcodeImageFormat.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { diff --git a/src/Model/CodeLocation.cs b/src/Model/CodeLocation.cs index dee08b5..1148996 100644 --- a/src/Model/CodeLocation.cs +++ b/src/Model/CodeLocation.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { diff --git a/src/Model/DecodeBarcodeType.cs b/src/Model/DecodeBarcodeType.cs index 0db0b82..198ab69 100644 --- a/src/Model/DecodeBarcodeType.cs +++ b/src/Model/DecodeBarcodeType.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { diff --git a/src/Model/EncodeBarcodeType.cs b/src/Model/EncodeBarcodeType.cs index 451bb01..24dba3e 100644 --- a/src/Model/EncodeBarcodeType.cs +++ b/src/Model/EncodeBarcodeType.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { diff --git a/src/Model/EncodeDataType.cs b/src/Model/EncodeDataType.cs index 33df5de..74c6ef9 100644 --- a/src/Model/EncodeDataType.cs +++ b/src/Model/EncodeDataType.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { diff --git a/src/Model/GraphicsUnit.cs b/src/Model/GraphicsUnit.cs index db017c0..41e0581 100644 --- a/src/Model/GraphicsUnit.cs +++ b/src/Model/GraphicsUnit.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { diff --git a/src/Model/RecognitionImageKind.cs b/src/Model/RecognitionImageKind.cs index deaab6b..bbc712b 100644 --- a/src/Model/RecognitionImageKind.cs +++ b/src/Model/RecognitionImageKind.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { diff --git a/src/Model/RecognitionMode.cs b/src/Model/RecognitionMode.cs index 9d40ef2..be37d92 100644 --- a/src/Model/RecognitionMode.cs +++ b/src/Model/RecognitionMode.cs @@ -1,7 +1,6 @@ using System.Text.Json.Serialization; - namespace Aspose.BarCode.Cloud.Sdk.Model { From e46767c96ef12792e9c33ed26b977e852c24d1d6 Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Wed, 23 Apr 2025 11:54:22 +0500 Subject: [PATCH 3/8] Try to suppress build errors --- src/Aspose.BarCode.Cloud.Sdk.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Aspose.BarCode.Cloud.Sdk.csproj b/src/Aspose.BarCode.Cloud.Sdk.csproj index 736608d..363ec34 100644 --- a/src/Aspose.BarCode.Cloud.Sdk.csproj +++ b/src/Aspose.BarCode.Cloud.Sdk.csproj @@ -4,6 +4,7 @@ netstandard2.0 true IDE0005;IDE0028;IDE1006; + true true latest-Recommended From 2a169f3decc214f3ee9e1b0677522d4efcf25290 Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Wed, 23 Apr 2025 12:19:14 +0500 Subject: [PATCH 4/8] Remove old frameworks Add new 9.0 version Update System.Text.Json version --- .github/workflows/dotnet-core.yml | 6 ++---- Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj | 2 +- Tests/RecognizeTests.cs | 2 +- Tests/ScanTests.cs | 2 +- src/Aspose.BarCode.Cloud.Sdk.csproj | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index ab09001..32b1d14 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -16,14 +16,12 @@ jobs: # and https://github.com/dotnet/core/blob/main/releases.md # for versions include: - - dotnet-version: 3.1.x - framework: netcoreapp3.1 - - dotnet-version: 5.0.x - framework: net5.0 - dotnet-version: 6.0.x framework: net6.0 - dotnet-version: 8.0.x framework: net8.0 + - dotnet-version: 9.0.x + framework: net9.0 continue-on-error: true diff --git a/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj b/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj index 41f9c0e..421bc22 100644 --- a/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj +++ b/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj @@ -1,7 +1,7 @@ - net462;net480;net481;netcoreapp3.1;net5.0;net6.0;net8.0 + net462;net480;net481;net6.0;net8.0;net9.0 true true 8.0 diff --git a/Tests/RecognizeTests.cs b/Tests/RecognizeTests.cs index 0a1918f..fd5c206 100644 --- a/Tests/RecognizeTests.cs +++ b/Tests/RecognizeTests.cs @@ -32,7 +32,7 @@ public async Task RecognizeBase64AsyncTest() using Stream image = GetTestImage("Test_PostGenerateMultiple.png"); byte[] buffer = new byte[image.Length]; - await image.ReadAsync(buffer, 0, buffer.Length); + _ = await image.ReadAsync(buffer, 0, buffer.Length); // Act BarcodeResponseList response = await _api.RecognizeBase64Async( diff --git a/Tests/ScanTests.cs b/Tests/ScanTests.cs index 418a30c..d8555bf 100644 --- a/Tests/ScanTests.cs +++ b/Tests/ScanTests.cs @@ -29,7 +29,7 @@ public async Task ScanBase64AsyncTest() byte[] buffer = new byte[image.Length]; - await image.ReadAsync(buffer, 0, buffer.Length); + _ = await image.ReadAsync(buffer, 0, buffer.Length); // Act BarcodeResponseList response = await _api.ScanBase64Async( new ScanBase64Request() diff --git a/src/Aspose.BarCode.Cloud.Sdk.csproj b/src/Aspose.BarCode.Cloud.Sdk.csproj index 363ec34..258ac75 100644 --- a/src/Aspose.BarCode.Cloud.Sdk.csproj +++ b/src/Aspose.BarCode.Cloud.Sdk.csproj @@ -4,7 +4,6 @@ netstandard2.0 true IDE0005;IDE0028;IDE1006; - true true latest-Recommended @@ -49,7 +48,7 @@ Aspose.Barcode for Cloud allows you to control all aspects of the image and barc - + From efdc18f0bb609b05622fa9efdaed301004cd80d4 Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Wed, 23 Apr 2025 12:22:31 +0500 Subject: [PATCH 5/8] Suppress warnings --- src/Aspose.BarCode.Cloud.Sdk.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Aspose.BarCode.Cloud.Sdk.csproj b/src/Aspose.BarCode.Cloud.Sdk.csproj index 258ac75..92c324b 100644 --- a/src/Aspose.BarCode.Cloud.Sdk.csproj +++ b/src/Aspose.BarCode.Cloud.Sdk.csproj @@ -4,6 +4,7 @@ netstandard2.0 true IDE0005;IDE0028;IDE1006; + true true latest-Recommended @@ -48,7 +49,7 @@ Aspose.Barcode for Cloud allows you to control all aspects of the image and barc - + From aba5f92f5f4eb091d0b08c20ffcaec266ba3a8f5 Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Wed, 23 Apr 2025 14:42:17 +0500 Subject: [PATCH 6/8] Removed out of support .net versions --- .github/workflows/dotnet-core.yml | 4 +--- README.md | 3 +-- Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj | 2 +- src/Aspose.BarCode.Cloud.Sdk.csproj | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml index 32b1d14..d185a74 100644 --- a/.github/workflows/dotnet-core.yml +++ b/.github/workflows/dotnet-core.yml @@ -1,4 +1,4 @@ -name: .NET Core Linux +name: .NET Linux on: push: @@ -16,8 +16,6 @@ jobs: # and https://github.com/dotnet/core/blob/main/releases.md # for versions include: - - dotnet-version: 6.0.x - framework: net6.0 - dotnet-version: 8.0.x framework: net8.0 - dotnet-version: 9.0.x diff --git a/README.md b/README.md index 921ae1c..75d3cd8 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,8 @@ This repository contains Aspose.BarCode Cloud SDK for .NET source code. This SDK Aspose.BarCode Cloud SDK for .NET provides cross-platform bindings for: -- .NET 5 and higher +- .NET 8 and higher - .NET Standard 2.0 and higher -- .NET Core 3.1 and higher - .NET Framework 4.6.2 and higher To use these SDKs, you will need Client Id and Client Secret which can be looked up at [Aspose Cloud Dashboard](https://dashboard.aspose.cloud/applications) (free registration in Aspose Cloud is required for this). diff --git a/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj b/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj index 421bc22..74b5277 100644 --- a/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj +++ b/Tests/Aspose.BarCode.Cloud.Sdk.Tests.csproj @@ -1,7 +1,7 @@ - net462;net480;net481;net6.0;net8.0;net9.0 + net462;net480;net481;net8.0;net9.0 true true 8.0 diff --git a/src/Aspose.BarCode.Cloud.Sdk.csproj b/src/Aspose.BarCode.Cloud.Sdk.csproj index 92c324b..258ac75 100644 --- a/src/Aspose.BarCode.Cloud.Sdk.csproj +++ b/src/Aspose.BarCode.Cloud.Sdk.csproj @@ -4,7 +4,6 @@ netstandard2.0 true IDE0005;IDE0028;IDE1006; - true true latest-Recommended @@ -49,7 +48,7 @@ Aspose.Barcode for Cloud allows you to control all aspects of the image and barc - + From ad1a52188251cb3e1334cfe22df072e85e9ce0e3 Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Wed, 23 Apr 2025 15:10:00 +0500 Subject: [PATCH 7/8] Check examples on latest linux and .net version --- .github/workflows/test-examples-and-snippets.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-examples-and-snippets.yml b/.github/workflows/test-examples-and-snippets.yml index a4d24dd..751fdd2 100644 --- a/.github/workflows/test-examples-and-snippets.yml +++ b/.github/workflows/test-examples-and-snippets.yml @@ -8,12 +8,15 @@ on: jobs: build-examples: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - name: Setup latest version of dotnet uses: actions/setup-dotnet@v4 + with: + dotnet-version: 'latest' - name: Build nuget with latest version run: | ./scripts/pack-nuget.bash From e17b3365259125934945d97cec34950b02226ecc Mon Sep 17 00:00:00 2001 From: Ivan Kamkin <234-Ivan.Kamkin@users.noreply.git.saltov.dynabic.com> Date: Wed, 23 Apr 2025 15:17:25 +0500 Subject: [PATCH 8/8] Fix target framework in example projects --- .github/workflows/test-examples-and-snippets.yml | 2 -- examples/GenerateQR/GenerateQR.csproj | 2 +- examples/ReadQR/ReadQR.csproj | 2 +- snippets/Snippets.csproj | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-examples-and-snippets.yml b/.github/workflows/test-examples-and-snippets.yml index 751fdd2..4d09d19 100644 --- a/.github/workflows/test-examples-and-snippets.yml +++ b/.github/workflows/test-examples-and-snippets.yml @@ -15,8 +15,6 @@ jobs: - uses: actions/checkout@v4 - name: Setup latest version of dotnet uses: actions/setup-dotnet@v4 - with: - dotnet-version: 'latest' - name: Build nuget with latest version run: | ./scripts/pack-nuget.bash diff --git a/examples/GenerateQR/GenerateQR.csproj b/examples/GenerateQR/GenerateQR.csproj index e9d5b37..4ce8d3f 100644 --- a/examples/GenerateQR/GenerateQR.csproj +++ b/examples/GenerateQR/GenerateQR.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/examples/ReadQR/ReadQR.csproj b/examples/ReadQR/ReadQR.csproj index e9d5b37..4ce8d3f 100644 --- a/examples/ReadQR/ReadQR.csproj +++ b/examples/ReadQR/ReadQR.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/snippets/Snippets.csproj b/snippets/Snippets.csproj index e9d5b37..4ce8d3f 100644 --- a/snippets/Snippets.csproj +++ b/snippets/Snippets.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable