From c3275f7f26be55f6da82e241f6da1756a34c21cf Mon Sep 17 00:00:00 2001 From: psiservices-dbrink Date: Thu, 4 Jan 2024 08:54:46 -0500 Subject: [PATCH 1/2] Correct incorrect pragma usage for restoring 8618 --- src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid b/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid index abd40c0bcd..2b32fbc3f9 100644 --- a/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid +++ b/src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid @@ -5,7 +5,7 @@ {% if UseBaseUrl and GenerateBaseUrlProperty -%} #pragma warning disable 8618 // Set by constructor via BaseUrl property private string _baseUrl; -#pragma restore disable 8618 // Set by constructor via BaseUrl property +#pragma warning restore 8618 // Set by constructor via BaseUrl property {% endif -%} {% if InjectHttpClient -%} private {{ HttpClientType }} _httpClient; From 9063588f68a54aa66a03b6a208b7e4f5297d2cde Mon Sep 17 00:00:00 2001 From: psiservices-dbrink Date: Thu, 4 Jan 2024 09:26:01 -0500 Subject: [PATCH 2/2] correcting generated sample spec --- ...mal_targetFramework=net7.0_generatesCode=True.verified.txt | 4 ++-- src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckCSharpClientsAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckCSharpClientsAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt index 5b5042463e..b7f0d8b958 100644 --- a/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckCSharpClientsAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt +++ b/src/NSwag.ConsoleCore.Tests/GenerateSampleSpecificationTests.CheckCSharpClientsAsync_projectName=NSwag.Sample.NET70Minimal_targetFramework=net7.0_generatesCode=True.verified.txt @@ -24,7 +24,7 @@ namespace MyNamespace { #pragma warning disable 8618 // Set by constructor via BaseUrl property private string _baseUrl; - #pragma restore disable 8618 // Set by constructor via BaseUrl property + #pragma warning restore 8618 // Set by constructor via BaseUrl property private System.Net.Http.HttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); @@ -498,7 +498,7 @@ namespace MyNamespace { #pragma warning disable 8618 // Set by constructor via BaseUrl property private string _baseUrl; - #pragma restore disable 8618 // Set by constructor via BaseUrl property + #pragma warning restore 8618 // Set by constructor via BaseUrl property private System.Net.Http.HttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); diff --git a/src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen b/src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen index 805daf0665..8014f6d504 100644 --- a/src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen +++ b/src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen @@ -24,7 +24,7 @@ namespace MyNamespace { #pragma warning disable 8618 // Set by constructor via BaseUrl property private string _baseUrl; - #pragma restore disable 8618 // Set by constructor via BaseUrl property + #pragma warning restore 8618 // Set by constructor via BaseUrl property private System.Net.Http.HttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true); @@ -498,7 +498,7 @@ namespace MyNamespace { #pragma warning disable 8618 // Set by constructor via BaseUrl property private string _baseUrl; - #pragma restore disable 8618 // Set by constructor via BaseUrl property + #pragma warning restore 8618 // Set by constructor via BaseUrl property private System.Net.Http.HttpClient _httpClient; private static System.Lazy _settings = new System.Lazy(CreateSerializerSettings, true);