Skip to content

Commit

Permalink
Disable warning CS8625 "Cannot convert null literal to non-nullable r…
Browse files Browse the repository at this point in the history
…eference type." in generated code (#4656)

* Disable warning CS8625

* Update File.Header.liquid

* Update File.Footer.liquid

* Fixed unit tests
  • Loading branch information
nhuethmayr authored Jan 10, 2024
1 parent 86aaf35 commit a199fad
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/NSwag.CodeGeneration.CSharp/Templates/File.Footer.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
#pragma warning restore 8073
#pragma warning restore 3016
#pragma warning restore 8603
#pragma warning restore 8604
#pragma warning restore 8604
#pragma warning restore 8625
3 changes: 2 additions & 1 deletion src/NSwag.CodeGeneration.CSharp/Templates/File.Header.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
#pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'"
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"

namespace MyNamespace
{
Expand Down Expand Up @@ -805,4 +806,5 @@ namespace MyNamespace
#pragma warning restore 8073
#pragma warning restore 3016
#pragma warning restore 8603
#pragma warning restore 8604
#pragma warning restore 8604
#pragma warning restore 8625
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"

namespace MyNamespace
{
Expand Down Expand Up @@ -157,4 +158,5 @@ namespace MyNamespace
#pragma warning restore 8073
#pragma warning restore 3016
#pragma warning restore 8603
#pragma warning restore 8604
#pragma warning restore 8604
#pragma warning restore 8625
4 changes: 3 additions & 1 deletion src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"

namespace MyNamespace
{
Expand Down Expand Up @@ -805,4 +806,5 @@ namespace MyNamespace
#pragma warning restore 8073
#pragma warning restore 3016
#pragma warning restore 8603
#pragma warning restore 8604
#pragma warning restore 8604
#pragma warning restore 8625
4 changes: 3 additions & 1 deletion src/NSwag.Sample.NET70Minimal/GeneratedControllersCs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant"
#pragma warning disable 8603 // Disable "CS8603 Possible null reference return"
#pragma warning disable 8604 // Disable "CS8604 Possible null reference argument for parameter"
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"

namespace MyNamespace
{
Expand Down Expand Up @@ -157,4 +158,5 @@ namespace MyNamespace
#pragma warning restore 8073
#pragma warning restore 3016
#pragma warning restore 8603
#pragma warning restore 8604
#pragma warning restore 8604
#pragma warning restore 8625

0 comments on commit a199fad

Please sign in to comment.