Skip to content

Commit

Permalink
Only generate MemberNotNull if NET_5_0_OR_GREATER
Browse files Browse the repository at this point in the history
  • Loading branch information
Staffan Gustafsson committed Feb 6, 2024
1 parent 0c9d87f commit 22e2181
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/NSwag.CodeGeneration.CSharp/Templates/Client.Class.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down Expand Up @@ -522,7 +524,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down Expand Up @@ -522,7 +524,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down
4 changes: 4 additions & 0 deletions src/NSwag.Sample.NET70Minimal/GeneratedClientsCs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down Expand Up @@ -522,7 +524,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down
4 changes: 4 additions & 0 deletions src/NSwag.Sample.NET80Minimal/GeneratedClientsCs.gen
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down Expand Up @@ -522,7 +524,9 @@ namespace MyNamespace
public string BaseUrl
{
get { return _baseUrl; }
#if NET5_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
#endif
set
{
_baseUrl = value;
Expand Down

0 comments on commit 22e2181

Please sign in to comment.