RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.61k stars 1.22k forks source link

[bug] NSwag v14.0.4 breaks on MemberNotNullAttribute, change 'Avoid generating unused _baseUrl (C# gen)' #4833

Closed sommmen closed 3 months ago

sommmen commented 3 months ago

Hello,

The latest release breaks, because of the following commit: Avoid generating unused _baseUrl (C# gen) https://github.com/RicoSuter/NSwag/commit/202f3c2d7e413f329d66dd0e18743578151cefa0 image

C:\Repos\lightr\src\Lightr\Lightr\obj\docsClient.cs(573,46,573,59): error CS0122: 'MemberNotNullAttribute' is inaccessible due to its protection level

https://github.com/sommmen/lightr/actions/runs/8416578516/job/23043462539?pr=5

The code is public: https://github.com/sommmen/lightr/tree/dependabot/nuget/NSwag.ApiDescription.Client-14.0.4 Api doc can be found here: https://github.com/sommmen/lightr/blob/dependabot/nuget/NSwag.ApiDescription.Client-14.0.4/src/Lightr/Lightr/OpenAPIs/docs.json

sommmen commented 3 months ago

Related so:

If your open documentation you will see that NotNullWhenAttribute applies to:

  • .NET Core 3.0, Core 3.1, 5, 6, 7, 8
  • .NET Standard 2.1

TBH I failed to build lib against .NET Standard 2.1 also, but you try can either install nuget like this one or implement this attribute yourself (like it is done in the runtime), cause AFAIK compiler quite often relies on naming and/or duck typing.

https://stackoverflow.com/a/61574692/4122889

My project targets netstandard2.1 so this should work but it seems to fail for some reason.

sommmen commented 3 months ago

this could be a dupe or regression of https://github.com/RicoSuter/NSwag/issues/4704

Vogel612 commented 3 months ago

Duplicates #4763 in addition

vvdb-architecture commented 3 months ago

Same problem in 14.0.5. Our proxies target NetStandard2.0, and it fails there as well.

RicoSuter commented 3 months ago

v14.0.6