-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSwag 14.0.1 still issues warning CS8618 #4704
Comments
Yes, the pragma restore of 8616 must happens after the ctor. Not after the _baseUrl field |
I think a better solution is to generate public string BaseUrl
{
get { return _baseUrl; }
[System.Diagnostics.CodeAnalysis.MemberNotNull(nameof(_baseUrl))]
set
{
_baseUrl = value;
if (!string.IsNullOrEmpty(_baseUrl) && !_baseUrl.EndsWith("/"))
_baseUrl += '/';
}
} To let the compiler null analysis know that the property setter sets the field _baseUrl. |
In my netstandard2.0 project, this gives: 'MemberNotNullAttribute' is inaccessible due to its protection level. |
this is completely fucked in 14.0.3
|
You should be able to reference the |
14.0.3 results in the same error as @rwb196884 reducing to 14.0.2 fixes |
Or simply do this. |
We're also getting the error again in 14.0.3. |
I also get this error in 14.0.3, on 14.0.2 it works as expected.
|
When compiling with 14.0.1, the generated C# sdk now has the following warning:
That's because even though the constructor assignes
BaseUrl
:... the compiler is unable to detect that the
_baseUrl
field is in fact initialized through this property.The way to get rid of the warning is to assign the field directly:
Also, the warnings reported in issue #4467 are still there.
The text was updated successfully, but these errors were encountered: